Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: in error message raised when invalid axis parameter #25555

simonjayhawkins opened this issue Mar 5, 2019 · 1 comment


Copy link

commented Mar 5, 2019

Code Sample, a copy-pastable example if possible

import numpy as np
from pandas import DataFrame
df = DataFrame(np.random.randn(6, 4))

Problem description


Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\simon\OneDrive\code\pandas-simonjayhawkins\pandas\core\", line 4575, in dropna
    axis = self._get_axis_number(axis)
  File "C:\Users\simon\OneDrive\code\pandas-simonjayhawkins\pandas\core\", line 361, in _get_axis_number
    .format(axis, type(cls)))
ValueError: No axis named 3 for object type <class 'type'>


ValueError                                Traceback (most recent call last)
<ipython-input-2-5ab8608d1d61> in <module>
      2 from pandas import DataFrame
      3 df = DataFrame(np.random.randn(6, 4))
----> 4 df.dropna(axis=3)

~\Anaconda3\lib\site-packages\pandas\core\ in dropna(self, axis, how, thresh, subset, inplace)
   4274                                        axis=ax)
   4275         else:
-> 4276             axis = self._get_axis_number(axis)
   4277             agg_axis = 1 - axis

~\Anaconda3\lib\site-packages\pandas\core\ in _get_axis_number(self, axis)
    373                 pass
    374         raise ValueError('No axis named {0} for object type {1}'
--> 375                          .format(axis, type(self)))
    377     def _get_axis_name(self, axis):

ValueError: No axis named 3 for object type <class 'pandas.core.frame.DataFrame'>

Expected Output

Output of pd.show_versions()

[paste the output of pd.show_versions() here below this line]


This comment has been minimized.

Copy link
Member Author

commented Mar 5, 2019

it appears the regression occurred in #23404. Should the fix be 0.24.2 or 0.25?

@jreback jreback added this to the 0.25.0 milestone Mar 5, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.