Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecation in yaml conversion #230

Open
smmaurer opened this issue Feb 11, 2021 · 1 comment
Open

Deprecation in yaml conversion #230

smmaurer opened this issue Feb 11, 2021 · 1 comment

Comments

@smmaurer
Copy link
Member

In Pandas 1.2+, pandas.Index.to_native_types() is deprecated, raising warnings like the following:

Screen_Shot_2021-02-09_at_11 52 05_AM1

This comes up in code that serializes data to yaml for storage and later reloading.

urbansim/utils/yamlio.py#L48

The replacement suggested in the message doesn't sound as general-purpose, but maybe it would work if Pandas is able to convert string representations of ints and floats back to the appropriate data type. Another option could be to use to_json().

pandas.Index.to_native_types()
pandas.Series.astype()
pandas.Series.to_json()

@mbarison
Copy link

I can confirm this is definitively broken with Pandas 2.0.0. The workaround is to replace pandas.Index.to_native_types() with pandas.Index.format()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants