I'm working with a big dataset and when I'm performing this function:
data1['total_t_1'] = data1.groupby(level=0)['total_tax'].apply(lambda x: x.shift())
I'm getting this error: SettingWithCopyWarning: A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc [row_indexer, col_indexer] = value instead.
I recognize that the error is on this part: apply(lambda x: x.shift())
Can somebody would advice me what to do to avoid this issue?