In the following example code I am trying to use the df.shift() function which pandas normally executes flawlessly. However, when using modin, the .shift() function ceases to work. Is there any way to fix this?
import modin.pandas as pd
import ray
ray.init(runtime_env={'env_vars': {'__MODIN_AUTOIMPORT_PANDAS__': '1'}})
df = pd.read_csv('dataframe.csv')
df['test'] = 1
df['shift'] = df['test'].shift()
ValueError: Length mismatch: Expected axis has 2 elements, new values have 604402 elements
This is a known bug in Modin. To work around the bug, you can use modin's _to_pandas method, apply the method on the pandas dataframe, then convert the result back to Modin, e.g.: