We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
import numpy as np import pandas as pd groups = np.array(["A", "B"]) years = np.arange(2015, 2018) values = np.arange(1,3) table = np.array([years.repeat(len(groups)), np.tile(groups, len(years)), np.tile(values, len(years))]).T table = pd.DataFrame(table, columns = ["year", "group", "val"]) table["year"] = table["year"].astype(int) table["val"] = table["val"].astype(int) table["group"] = table["group"].astype(str) grp = table.groupby("year") grp.rank()
Running the rank method on the grouped table throws TypeError: 'NoneType' object is not callable
TypeError: 'NoneType' object is not callable
It should return ranked data for each year, or a descriptive error message.
pd.show_versions()
commit : None python : 3.6.9.final.0 python-bits : 64 OS : Linux OS-release : 4.15.0-70-generic machine : x86_64 processor : x86_64 byteorder : little LC_ALL : None LANG : en_US.UTF-8 LOCALE : en_US.UTF-8
pandas : 0.25.3 numpy : 1.17.4 pytz : 2019.3 dateutil : 2.8.1 pip : 9.0.1 setuptools : 39.0.1 Cython : None pytest : None hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : None lxml.etree : None html5lib : 0.999999999 pymysql : 0.9.3 psycopg2 : None jinja2 : 2.10.3 IPython : 7.10.2 pandas_datareader: None bs4 : None bottleneck : None fastparquet : None gcsfs : None lxml.etree : None matplotlib : 3.1.2 numexpr : None odfpy : None openpyxl : None pandas_gbq : None pyarrow : None pytables : None s3fs : None scipy : None sqlalchemy : None tables : None xarray : None xlrd : None xlwt : None xlsxwriter : None
The text was updated successfully, but these errors were encountered:
Thanks for the excellent report. This appears to be "fixed" on master, as no error is raised.
In [2]: import numpy as np ...: import pandas as pd ...: ...: groups = np.array(["A", "B"]) ...: years = np.arange(2015, 2018) ...: values = np.arange(1,3) ...: ...: table = np.array([years.repeat(len(groups)), np.tile(groups, len(years)), np.tile(values, len(years))]).T ...: ...: table = pd.DataFrame(table, columns = ["year", "group", "val"]) ...: ...: table["year"] = table["year"].astype(int) ...: table["val"] = table["val"].astype(int) ...: table["group"] = table["group"].astype(str) ...: ...: grp = table.groupby("year") ...: ...: grp.rank() Out[2]: val 0 1.0 1 2.0 2 1.0 3 2.0 4 1.0 5 2.0
We still have #19560 for discussing what to do with non-numeric data.
Sorry, something went wrong.
No branches or pull requests
Code Sample, a copy-pastable example if possible
Problem description
Running the rank method on the grouped table throws
TypeError: 'NoneType' object is not callable
Expected Output
It should return ranked data for each year, or a descriptive error message.
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : None
python : 3.6.9.final.0
python-bits : 64
OS : Linux
OS-release : 4.15.0-70-generic
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 0.25.3
numpy : 1.17.4
pytz : 2019.3
dateutil : 2.8.1
pip : 9.0.1
setuptools : 39.0.1
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : 0.999999999
pymysql : 0.9.3
psycopg2 : None
jinja2 : 2.10.3
IPython : 7.10.2
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : None
matplotlib : 3.1.2
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
xarray : None
xlrd : None
xlwt : None
xlsxwriter : None
The text was updated successfully, but these errors were encountered: