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
Sometimes when shifting a variable by groups, if there are NaNs in the group column, it crashes my kernel. Sometimes the operation completes successfully, though it crashes over half the time.
Code Sample, a copy-pastable example if possible
from numpy import nan
import pandas as pd
from pandas import Timestamp
df = pd.DataFrame(data = [
(Timestamp('2003-01-15 00:00:00'), 1, 1),
(Timestamp('2003-01-15 00:00:00'), nan, nan),
(Timestamp('2003-02-14 00:00:00'), 1, 2),
], columns=['Date','ID','var'])
test.groupby('ID')['var'].shift(1) #crashes kernel sometimes
test.dropna(subset=['ID']).groupby('ID')['var'].shift(1) #does not crash kernel
test.groupby('ID')['var'].apply(lambda x: x) #does not crash kernel
I have all the latest versions as of today and kernel crashes because one of the records in the groupby has a nan. Had to go around it filtering first with .nonull()
Sometimes when shifting a variable by groups, if there are NaNs in the group column, it crashes my kernel. Sometimes the operation completes successfully, though it crashes over half the time.
Code Sample, a copy-pastable example if possible
Expected Output
output of
pd.show_versions()
The text was updated successfully, but these errors were encountered: