Guided Project: Exploring eBay Car Sales Data, convert the "date_crawled" to int

Screen Link:
https://app.dataquest.io/c/54/m/294/guided-project%3A-exploring-ebay-car-sales-data/5/exploring-the-date-columns

My Code:

Replace this line with your code

autos[“date_crawled”].value_counts()

What I expected to happen:
is to find a string format for this serie but after running the code above , shows that it’s int64 which dosen’t need to be converted

What actually happened:
2016-04-02 11:37:04 3
2016-03-08 10:40:35 3
2016-03-19 17:36:18 3
2016-03-16 21:50:53 3
2016-03-25 19:57:10 3

2016-03-15 20:47:31 1
2016-03-14 13:59:42 1
2016-03-12 20:52:21 1
2016-03-10 09:52:15 1
2016-03-29 10:39:57 1
Name: date_crawled, Length: 43660, dtype: int64

but in the same time if i do run the following code to check the data type of autos 
autos.dtypes , i found that "date_crawled" is not a int64,
my question is why in the first code was showing int64 and wjen checking the dtypes it shows object?
thank you for your help.
1 Like

value_counts() gives you the data type of values not indexes. But remember the cell values became indexes and their value_counts are the values… (confusing?) SO:

What actually happened:
2016-04-02 11:37:04        3

(added some extra spacing to make it more readable)
Lets look at the first row:

  • index is ‘2016-04-02 11:37:04’
  • value is ‘3’
  • So the data type of above value(which is 3) is integer.

If you were to normalize it:

autos['date_crawled'].value_counts(normalize=True)

it would change to floats. But it won’t give you the format of index.

it really make a sence, thanks alot :smile: