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
WillAyd
changed the title
df.groupby(cols).tshift(0, freq) deletes cols when shift is zero
df.groupby(cols).tshift(0, freq) Drops Index Level When Shift is Zero
Jul 25, 2018
WillAyd
added
Indexing
Related to indexing on series/frames, not to indexes themselves
MultiIndex
Reshaping
Concat, Merge/Join, Stack/Unstack, Explode
and removed
Indexing
Related to indexing on series/frames, not to indexes themselves
labels
Jul 25, 2018
Now that I think about it... that groupby is not really necessary for this process, I could just shift the date directly. What concerns me is that when tshifting with shift == 0 is not compatible with shift != 0, but maybe that is something intrinsic to tshift
See comment in #23918 . The inconsistencies a problem though I think the intended behavior here is the opposite of what is requested, as the request would break alignment with the original caller.
Code Sample, a copy-pastable example if possible
Problem description
In short words, tshift after a groupby deletes the groupby columns ("categories" in this case) if the shift used was zero
Expected Output
NOTE: This is the output format of any non zero shift (of course with the dates shifted)
Output of
pd.show_versions()
[paste the output of
pd.show_versions()
here below this line]INSTALLED VERSIONS
commit: None
python: 3.6.5.final.0
python-bits: 64
OS: Linux
OS-release: 4.17.3-200.fc28.x86_64
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8
pandas: 0.23.3
pytest: None
pip: 9.0.3
setuptools: 39.2.0
Cython: 0.28.4
numpy: 1.14.5
scipy: 1.1.0
pyarrow: None
xarray: None
IPython: 6.4.0
sphinx: None
patsy: None
dateutil: 2.7.3
pytz: 2017.2
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: 2.2.2
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: None
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: