Course Content
Analyzing and Visualizing Real-World Data
Analyzing and Visualizing Real-World Data
Proper Converting
Fortunately, this issue can be easily fixed. The .to_datetime()
method has yearfirst
and dayfirst
boolean parameters that define whether dates start with the year or day, respectively. By default, both parameters are set to False
, which is why the first numbers were considered as months (if possible). Since the dates in our data start with the day, we just need to set the dayfirst
parameter to True
.
Swipe to show code editor
- Convert the
'Date'
column todatetime
type, considering that the day comes first. - Output the first 5 rows and dtypes of the
df
dataframe.
Thanks for your feedback!
Proper Converting
Fortunately, this issue can be easily fixed. The .to_datetime()
method has yearfirst
and dayfirst
boolean parameters that define whether dates start with the year or day, respectively. By default, both parameters are set to False
, which is why the first numbers were considered as months (if possible). Since the dates in our data start with the day, we just need to set the dayfirst
parameter to True
.
Swipe to show code editor
- Convert the
'Date'
column todatetime
type, considering that the day comes first. - Output the first 5 rows and dtypes of the
df
dataframe.
Thanks for your feedback!
Proper Converting
Fortunately, this issue can be easily fixed. The .to_datetime()
method has yearfirst
and dayfirst
boolean parameters that define whether dates start with the year or day, respectively. By default, both parameters are set to False
, which is why the first numbers were considered as months (if possible). Since the dates in our data start with the day, we just need to set the dayfirst
parameter to True
.
Swipe to show code editor
- Convert the
'Date'
column todatetime
type, considering that the day comes first. - Output the first 5 rows and dtypes of the
df
dataframe.
Thanks for your feedback!
Fortunately, this issue can be easily fixed. The .to_datetime()
method has yearfirst
and dayfirst
boolean parameters that define whether dates start with the year or day, respectively. By default, both parameters are set to False
, which is why the first numbers were considered as months (if possible). Since the dates in our data start with the day, we just need to set the dayfirst
parameter to True
.
Swipe to show code editor
- Convert the
'Date'
column todatetime
type, considering that the day comes first. - Output the first 5 rows and dtypes of the
df
dataframe.