Skip to content
This repository was archived by the owner on Jan 9, 2023. It is now read-only.
This repository was archived by the owner on Jan 9, 2023. It is now read-only.

Problem with saving DataFrames to root files when they contain dtype object #38

Closed
@FerdinandEiteneuer

Description

@FerdinandEiteneuer

Hi,

i have several textfiles with strings and floats in them. I can load them into a panda dataframe nicely.
I also need to save them in root format and wanted to use this library.

However, when i call the to_root function on my dataframe i got the following:

UserWarning: converter for dtype('O') is not implemented skipping

And indeed, if I load the rootfile later with read_root later the columns with strings in them miss.

I then tried this:

>>> for c in df.columns:
... if df[c].dtype == object:
... df[c] = df[c].astype(str)

Now i did not get any error message using to_root. However, when i load the root file later to a pandas dataframe it still misses the columns where strings are supposed to be.

How to fix this?
Thank you very much

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