LoslegenKostenlos loslegen

Dates (I)

You will often come across timeseries data during your Data Science journey. It is important you know how to parse them correctly and Pandas provides convenient functions for you to deal with them. If you have a date column that is in the form of a string, you can easily convert it to a datetime format using the pd.to_datetime() function. You need to specify the format argument that specifies in which format the dates exist. If the dates are in the month/day/year format, you would use:

pd.to_datetime(df['date_column_as_string'], format='%m/%d/%Y')

Having dates in this format is far more desirable as you will see in the next exercise.

Diese Übung ist Teil des Kurses

Python for R Users

Kurs anzeigen

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

import pandas as pd

# Load the country_timeseries dataset
ebola = pd.____('country_timeseries.csv')

# Inspect the Date column
print(ebola['Date'].dtype)
Code bearbeiten und ausführen