What is dtype('O'), in pandas?

前端 未结 4 1108
我在风中等你
我在风中等你 2020-12-02 07:08

I have a dataframe in pandas and I\'m trying to figure out what the types of its values are. I am unsure what the type is of column \'Test\'. However, when I ru

4条回答
  •  无人及你
    2020-12-02 08:10

    'O' stands for object.

    #Loading a csv file as a dataframe
    import pandas as pd 
    train_df = pd.read_csv('train.csv')
    col_name = 'Name of Employee'
    
    #Checking the datatype of column name
    train_df[col_name].dtype
    
    #Instead try printing the same thing
    print train_df[col_name].dtype
    

    The first line returns: dtype('O')

    The line with the print statement returns the following: object

提交回复
热议问题