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

Offen Anfängerfreundlich
#204 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
1/5
Geschätzter Aufwand
Unter einer Stunde
Anfängerfreundlichkeit
88/100
Issue-Typ
Dokumentation
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
pandas, python
Bereich
documentation

Rechercherichtung

Öffne die Instructor-Lektion im Abschnitt „Adding a date column“ von instructor/tidy.html. Suche das Beispiel df_long.set_index('date', inplace=True) und ändere es so, dass der zurückgegebene DataFrame wieder df_long zugewiesen wird. Fertig ist die Änderung, wenn die Lektion die aktualisierte Form ohne das veraltete Argument inplace zeigt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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

Vorherrschende Sprache
HTML
Sterne
25
Forks
65
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus LibraryCarpentry/lc-python-intro

Alle Issues in LibraryCarpentry/lc-python-intro

Ähnliche Issues

Weitere Issues zu Documentation

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.