BUG: sort_values with ascending=None and key!=None raises exception #41318
Labels
Enhancement
Error Reporting
Incorrect or improved errors from pandas
Needs Discussion
Requires discussion from core team before further action
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
(optional) I have confirmed this bug exists on the master branch of pandas.
Note: Please read this guide detailing how to provide the necessary information for us to reproduce your bug.
Code Sample, a copy-pastable example
Problem description
Output is
Function
validate_argsort_with_ascending
inserts a value forascending
argument in case it isNone
, but later this value is considered as a value ofaxis
parameter for some reason. This leads to an exception instead of a normal operation.Expected Output
Output of
pd.show_versions()
[paste the output of
pd.show_versions()
here leaving a blank line after the details tag]INSTALLED VERSIONS
commit : 2cb9652
python : 3.8.6.final.0
python-bits : 64
OS : Linux
OS-release : 5.4.0-72-generic
Version : #80-Ubuntu SMP Mon Apr 12 17:35:00 UTC 2021
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 1.2.4
numpy : 1.19.5
pytz : 2021.1
dateutil : 2.8.1
pip : 21.0.1
setuptools : 49.6.0.post20210108
Cython : None
pytest : 6.2.3
hypothesis : None
sphinx : 3.5.4
blosc : None
feather : 0.4.1
xlsxwriter : None
lxml.etree : 4.6.3
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.11.3
IPython : 7.20.0
pandas_datareader: None
bs4 : 4.9.3
bottleneck : None
fsspec : 0.8.5
fastparquet : None
gcsfs : None
matplotlib : 3.2.2
numexpr : 2.7.2
odfpy : None
openpyxl : 3.0.7
pandas_gbq : 0.15.0
pyarrow : 1.0.0
pyxlsb : None
s3fs : None
scipy : 1.6.2
sqlalchemy : 1.4.8
tables : 3.6.1
tabulate : None
xarray : 0.17.0
xlrd : 2.0.1
xlwt : None
numba : None
The text was updated successfully, but these errors were encountered: