Skip to content

AttributeError: 'float' object has no attribute 'encode' #313

@lapalus

Description

@lapalus

I have upgraded pyreadstat to 1.3.x and encounter an error from code that previously worked. I have a very large dataset and it is hard to share. Problem occurs from version 1.3.0 and is present in all following versions.

Does anyone know of any change from 1.3.0 -> that can explain this?

The error i get is the following:

3857 # Write sav file to the temporary file
-> 3858 pyreadstat.write_sav(
   3859     data,
   3860     temp_path,
   3861     compress=True,
   3862     variable_value_labels=value_labels,
   3863     column_labels=variable_labels,
   3864     variable_measure=variable_measures,
   3865     variable_display_width=variable_display_width,
   3866     variable_format=variable_formats
   3867 )
   3869 temp_file.seek(0)
   3870 sav_content = temp_file.read()

File pyreadstat/pyreadstat.pyx:784, in pyreadstat.pyreadstat.write_sav()

File pyreadstat/_readstat_writer.pyx:730, in pyreadstat._readstat_writer.run_write()

File pyreadstat/_readstat_writer.pyx:333, in pyreadstat._readstat_writer.get_narwhals_column_types()

File pyreadstat/_readstat_writer.pyx:227, in pyreadstat._readstat_writer.get_narwhals_str_series_max_length()

AttributeError: 'float' object has no attribute 'encode'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions