简体   繁体   中英

.describe method gives result as another data type compares to describe() in pandas regarding date-time format

When I check with data.describe it shows date time format where as when I check through.describe() method, It gives data type as object type. What is the problem?

data['Date'].describe()

count                     494
unique                    494
top       2017-10-30 00:00:00
freq                        1
first     2017-05-15 00:00:00
last      2019-05-13 00:00:00
Name: Date, dtype: object
data['Date'].describe

<bound method NDFrame.describe of 0     2017-05-15
1     2017-05-16
2     2017-05-17
3     2017-05-18
4     2017-05-19
         ...    
491   2019-05-07
492   2019-05-08
493   2019-05-09
494   2019-05-10
495   2019-05-13
Name: Date, Length: 494, dtype: datetime64[ns]>

df.describe() : calls the method and returns the result.

df.describe : is the method itself (you can think of a 'pointer to method' in some other languages)

> p = df.describe 
> p()

> df.describe()

Both p() and df.describe() gives same result.

I will recommand you use df.info() if you want to check type of all the columns.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM