Last answered:

29 Dec 2022

Posted on:

03 Nov 2022

1

Writing loan_data_inputs_test to csv fails

Hi! I can not write the test data to the .csv, the following error appears:

in NDFrame.to_csv(self, path_or_buf, sep, na_rep, float_format, columns, header, index, index_label, mode, encoding, compression, quoting, quotechar, line_terminator, chunksize, date_format, doublequote, escapechar, decimal, errors, storage_options)  3540 df = self if isinstance(self, ABCDataFrame) else self.to_frame()  3542 formatter = DataFrameFormatter(  3543 frame=df,  3544 header=header, (...)  3548 decimal=decimal,  3549 ) -> 3551 return DataFrameRenderer(formatter).to_csv(  3552 path_or_buf,  3553 line_terminator=line_terminator,  3554 sep=sep,  3555 encoding=encoding,  3556 errors=errors,  3557 compression=compression,  3558 quoting=quoting,  3559 columns=columns,  3560 index_label=index_label,
...
1103 "can only insert Interval objects and NA into an IntervalArray"  1104 )  1105 return left, right TypeError: can only insert Interval objects and NA into an IntervalArray

inputs_test.s
Can I have the .csv files that were the output of this module, so I can continue with the next module? Thanks! Especially loan_data_inputs_test.csv

4 answers ( 0 marked as helpful)
Super learner
This user is a Super Learner. To become a Super Learner, you need to reach Level 8.
Posted on:

09 Nov 2022

0

I have the same issue... Have you found out what causes it??

Posted on:

11 Nov 2022

1

Try to remove the columns with the type 'category'. You can use the following code to store categorical columns in a variable:
category_cols = [col for col in df_inputs.columns if df_inputs[col].dtypes == 'category']
print(df_inputs[category_cols])
The following code will remove these columns:
df_inputs_copy = df_inputs.drop(category_cols, axis=1)

Hope you find this helpful.

Super learner
This user is a Super Learner. To become a Super Learner, you need to reach Level 8.
Posted on:

11 Nov 2022

1

Thanks, Aditya! Yeah, after some investigation I have done the same, just dropped the 'category' columns.

Posted on:

29 Dec 2022

0

did not that affected your model rinat? thanks

Submit an answer