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

pandas warning in data.get_turbine_types() #143

Open
mkaut opened this issue Sep 26, 2024 · 0 comments
Open

pandas warning in data.get_turbine_types() #143

mkaut opened this issue Sep 26, 2024 · 0 comments

Comments

@mkaut
Copy link

mkaut commented Sep 26, 2024

Calling wpl.data.get_turbine_types() with pandas 2.2.3 throws the following warning at windpowerlib/data.py:103:

 FutureWarning: Downcasting object dtype arrays on .fillna, .ffill, .bfill is deprecated and will change in a future version. Call result.infer_objects(copy=False) instead. To opt-in to the future behavior, set `pd.set_option('future.no_silent_downcasting', True)`

This is caused by .fillna(False) in the following:

curves_df = pd.merge(
    p_curves_df, cp_curves_df, how="outer", sort=True
).fillna(False)

I am no developer, but I did some reading about the warning and this seems to be a clean (and possible the "correct") way to get rid of it:

with pd.option_context('future.no_silent_downcasting', True):
    curves_df = pd.merge(
        p_curves_df, cp_curves_df, how="outer", sort=True
    ).fillna(False).infer_objects()
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

1 participant