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
I have searched the [pandas] tag on StackOverflow for similar questions.
I have asked my usage related question on StackOverflow.
Question about pandas
Hi there, my understanding of the df.groupby.rolling for a multi index dataframe should preserve the level-1 index, but I can't seem to get that. I am running Pandas 1.2.4. Hope that somebody can provide some insight of what is happening
base don the online guides, I would expect the level 1 index to be preserved...but I can't understand what is currently happening at this case? or what is the correct way of doing it.
Hope that somebody can provide some insights with regards to this problem
EDIT: Edited as text for readability, apologies for posting images earlier, forgot about it while posting it just now
The text was updated successfully, but these errors were encountered:
Yes this was fixed recently by #40701 and will be fixed in the 1.3 release. Unfortunately this has been broken since the 1.1.3 release.
In [1]: x = range(0, 6)
...: id = ['a', 'a', 'a', 'b', 'b', 'b']
...: temp = pd.DataFrame(zip(id, x), columns = ['id', 'x'])
...: temp['sequence']=[0,1,2,0,1,2]
...: temp=temp.set_index(['id','sequence'])
...: print(temp)
x
id sequence
a 0 0
1 1
2 2
b 0 3
1 4
2 5
In [2]: temp.groupby(level=0,group_keys=True).rolling(2, min_periods=1).min()
Out[2]:
x
id id sequence
a a 0 0.0
1 0.0
2 1.0
b b 0 3.0
1 3.0
2 4.0
In [3]: pd.__version__
Out[3]: '1.3.0.dev0+1392.g11545d5023'
Thanks for the report. Going to close as fixed in a future release.
I have searched the [pandas] tag on StackOverflow for similar questions.
I have asked my usage related question on StackOverflow.
Question about pandas
Hi there, my understanding of the df.groupby.rolling for a multi index dataframe should preserve the level-1 index, but I can't seem to get that. I am running Pandas 1.2.4. Hope that somebody can provide some insight of what is happening
base don the online guides, I would expect the level 1 index to be preserved...but I can't understand what is currently happening at this case? or what is the correct way of doing it.
Hope that somebody can provide some insights with regards to this problem
EDIT: Edited as text for readability, apologies for posting images earlier, forgot about it while posting it just now
The text was updated successfully, but these errors were encountered: