What are Python pandas equivalents for R functions like str(), summary(), and head()?

后端 未结 7 1101
别跟我提以往
别跟我提以往 2020-11-29 21:26

I\'m only aware of the describe() function. Are there any other functions similar to str(), summary(), and head()?

7条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-29 22:08

    For a Python equivalent to the str() function in R, I use the method dtypes. This will provide the data types for each column.

    In [22]: df2.dtypes
    Out[22]: 
    Survived      int64
    Pclass        int64
    Sex          object
    Age         float64
    SibSp         int64
    Parch         int64
    Ticket       object
    Fare        float64
    Cabin        object
    Embarked     object
    dtype: object
    

提交回复
热议问题