You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As far as I know, auto-alignment of DataFrames and Series (e.g. with arithmetic operations) cannot be disabled. To work in "strict" mode, the user must first check alignment and then make a computation:
a = pd.DataFrame(...)
b = pd.DataFrame(...)
c = pd.Series(...)
d = pd.Series(...)
if not a.index.equals(b.index) or not a.columns.equals(b.columns):
raise ...
k = a + b
if not c.index.equals(d.index):
raise ...
m = c + d
Since alignment must also be checked internally by pandas, this is not only cumbersome but inefficient.
Feature Description
Use the pandas option framework to opt-out of auto-alignment. One could even go one step further to allow deactivation of alignment check altogether for data that is known to be aligned (to gain some computation time). So the option would look like: mode.on_misaligned:
coerce: default and current behaviour
raise: strict mode, raise an error if indices are not aligned
ignore: skip alignment checking and proceed with the computation assuming data is already aligned
The user would then set the option as he sees fit, e.g. with a context manager:
with pd.option_context("mode.on_misaligned", "raise"):
k = a + b
m = c + d
Alternative Solutions
The alternative solution is the problem
Additional Context
No response
The text was updated successfully, but these errors were encountered:
Feature Type
Adding new functionality to pandas
Changing existing functionality in pandas
Removing existing functionality in pandas
Problem Description
As far as I know, auto-alignment of DataFrames and Series (e.g. with arithmetic operations) cannot be disabled. To work in "strict" mode, the user must first check alignment and then make a computation:
Since alignment must also be checked internally by pandas, this is not only cumbersome but inefficient.
Feature Description
Use the pandas option framework to opt-out of auto-alignment. One could even go one step further to allow deactivation of alignment check altogether for data that is known to be aligned (to gain some computation time). So the option would look like:
mode.on_misaligned
:coerce
: default and current behaviourraise
: strict mode, raise an error if indices are not alignedignore
: skip alignment checking and proceed with the computation assuming data is already alignedThe user would then set the option as he sees fit, e.g. with a context manager:
Alternative Solutions
The alternative solution is the problem
Additional Context
No response
The text was updated successfully, but these errors were encountered: