BaşlayınÜcretsiz Başlayın

Test whether your data is of the correct type

When working with time series data in pandas, any date information should be formatted as a datetime64 type. Therefore, it is important to check that the columns containing the date information are of the correct type. You can check the type of each column in a DataFrame by using the .dtypes attribute. Fortunately, if your date columns come as strings, epochs, etc… you can use the to_datetime() function to convert them to the appropriate datetime64 type:

df['date_column'] = pd.to_datetime(df['date_column'])

In this exercise, you will learn how to check the data type of the columns in your time series data and convert a date column to the appropriate datetime type.

Bu egzersiz

Visualizing Time Series Data in Python

kursunun bir parçasıdır
Kursu Görüntüle

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Print the data type of each column in discoveries
print(discoveries____)
Kodu Düzenle ve Çalıştır