Already pip3 installed latest version of pyarrow(15.0.2) and polars(0.20.16) but still got an error

50 Views Asked by At

I tried to change polars.dataframe to pandas

def to_pandas(df_data, cat_cols=None):
    df_data = df_data.to_pandas() #<-- error on this line
    
    if cat_cols is None:
        cat_cols = list(df_data.select_dtypes("object").columns)
    
    df_data[cat_cols] = df_data[cat_cols].astype("category")
    
    return df_data, cat_cols
df_train, cat_cols = to_pandas(df_train)
df_test, cat_cols = to_pandas(df_test, cat_cols)

ModuleNotFoundError                       Traceback (most recent call last)
Cell In[135], line 1
----> 1 df_train, cat_cols = to_pandas(df_train)
      2 df_test, cat_cols = to_pandas(df_test, cat_cols)

Cell In[134], line 2
      1 def to_pandas(df_data, cat_cols=None):
----> 2     df_data = df_data.to_pandas()
      4     if cat_cols is None:
      5         cat_cols = list(df_data.select_dtypes("object").columns

the error said 'ModuleNotFoundError: pa.Table requires 'pyarrow' module to be installed'

I'm very confused since I already pip3 installed both pyarrow and polars and import pyarrow as pa,import polars as pl both of them are working but I don't know I got error on pa.Table

0

There are 0 best solutions below