Use the memory-efficient pyarrow string dtype (pandas >= 1.3 only)
(df: pd.DataFrame)
| 127 | |
| 128 | |
| 129 | def str_to_arrow_str(df: pd.DataFrame): |
| 130 | """Use the memory-efficient pyarrow string dtype (pandas >= 1.3 only)""" |
| 131 | # convert objects to str / NA |
| 132 | df_str = df.select_dtypes("string") |
| 133 | df[df_str.columns] = df_str.astype("string[pyarrow]") |
| 134 | |
| 135 | |
| 136 | def process_df(df: pd.DataFrame, copy: bool = False) -> pd.DataFrame: |
no outgoing calls
no test coverage detected