Skip to content

pandas warning in data.get_turbine_types() #143

Description

@mkaut

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()

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