Processing Dates
We are close to finishing! Let's see what data types our data has now.
As you can see, there is only one object
column left. You may be wondering why this is bad. Actually, we can leave it as is, but pandas
provides us with tools to work with dates and times. Unfortunately, datetime
is not a built-in data type in Python, so we can't convert the column and save it. We will have to convert it after loading every time. To convert to datetime
type, we need to use the .to_datetime()
method of pd
.
As you can see, visually the dates have changed, i.e., they are now represented in a different format.
Everything was clear?
Course Content
Analyzing and Visualizing Real-World Data
Analyzing and Visualizing Real-World Data
2. Preprocessing Data: Part II
Processing Dates
We are close to finishing! Let's see what data types our data has now.
As you can see, there is only one object
column left. You may be wondering why this is bad. Actually, we can leave it as is, but pandas
provides us with tools to work with dates and times. Unfortunately, datetime
is not a built-in data type in Python, so we can't convert the column and save it. We will have to convert it after loading every time. To convert to datetime
type, we need to use the .to_datetime()
method of pd
.
As you can see, visually the dates have changed, i.e., they are now represented in a different format.
Everything was clear?