Skip to content

Change code to set the date field as an index in adding a data in the Tidy Data Episode #204

Open

Description

@scottcpeterson

How could the content be improved?

Pandas is phasing out,

df_long.set_index('date', inplace=True)

and you will get a warning message about this in newer versions of Pandas,

/tmp/xpython_42/2051253388.py:1: Pandas4Warning: The inplace keyword in DataFrame.set_index is deprecated and will be removed in a future version (PDEP-8).
See https://pandas.pydata.org/docs/dev/whatsnew/v3.1.0.html#deprecation-inplace for more details.
df_long.set_index('date', inplace=True)

The code for setting the date field as the index should be changed to the updated code,

df_long = df_long.set_index('date')

Which part of the content does your suggestion apply to?

https://librarycarpentry.github.io/lc-python-intro/instructor/tidy.html#adding-a-date-column

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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