pyarrow.lib.ArrowInvalid: Needed to copy 1 chunks with 1 nulls, but zero_copy_only was True

问题

Error executing job with overrides: ['phase=test']
Traceback (most recent call last):
  File "/home/li/cmi/cmi-code-1114-shape/run/prepare_data.py", line 148, in main
    save_each_series(this_series_df, FEATURE_NAMES, series_dir)
  File "/home/li/cmi/cmi-code-1114-shape/run/prepare_data.py", line 95, in save_each_series
    x = this_series_df.get_column(col_name).to_numpy(zero_copy_only=True)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/li/anaconda3/envs/py11/lib/python3.11/site-packages/polars/series/series.py", line 4183, in to_numpy
    return self.to_arrow().to_numpy(
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pyarrow/array.pxi", line 1475, in pyarrow.lib.Array.to_numpy
  File "pyarrow/error.pxi", line 100, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: Needed to copy 1 chunks with 1 nulls, but zero_copy_only was True

 解决方案

思路1:x = np.nan_to_num(x,nan=-1) 

思路2:

            for col in ["anglez_diff"]:

                this_series_df = this_series_df.with_columns(

                    pl.col(col).fill_null(pl.lit(-1)),

                )

思路3 :1+2

你可能感兴趣的:(Bug,python)