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
This gives my a 2x2 table with the years 2018 and 2019 on both axes, thus wrongly treating the dt.month operation. The same thing happens if I replace dt.month with dt.day in my example. Interestingly, pd.crosstab(df["date"].dt.day, df["date"].dt.month) works as expected, while pd.crosstab(df["date"].dt.month, df["date"].dt.day) does not!
Expected Output
year
2018
2019
month
1
1
1
2
1
1
Output of pd.show_versions()
INSTALLED VERSIONS
commit : None
python : 3.7.4.final.0
python-bits : 64
OS : Windows
OS-release : 10
machine : AMD64
processor : Intel64 Family 6 Model 78 Stepping 3, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : None.None
Uh oh!
There was an error while loading. Please reload this page.
Code Sample
Problem description
This gives my a
2x2
table with the years 2018 and 2019 on both axes, thus wrongly treating thedt.month
operation. The same thing happens if I replacedt.month
withdt.day
in my example. Interestingly,pd.crosstab(df["date"].dt.day, df["date"].dt.month)
works as expected, whilepd.crosstab(df["date"].dt.month, df["date"].dt.day)
does not!Expected Output
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : None
python : 3.7.4.final.0
python-bits : 64
OS : Windows
OS-release : 10
machine : AMD64
processor : Intel64 Family 6 Model 78 Stepping 3, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : None.None
pandas : 0.25.1
numpy : 1.16.4
pytz : 2019.2
dateutil : 2.8.0
pip : 19.2.2
setuptools : 41.0.1
Cython : None
pytest : 5.0.1
hypothesis : 4.32.2
sphinx : 2.1.2
blosc : None
feather : None
xlsxwriter : 1.1.8
lxml.etree : 4.4.1
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.10.1
IPython : 7.8.0
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : 4.4.1
matplotlib : 3.1.1
numexpr : 2.7.0
odfpy : None
openpyxl : 2.6.2
pandas_gbq : None
pyarrow : None
pytables : None
s3fs : None
scipy : 1.3.1
sqlalchemy : None
tables : 3.5.2
xarray : None
xlrd : 1.2.0
xlwt : 1.3.0
xlsxwriter : 1.1.8
The text was updated successfully, but these errors were encountered: