Taruna_1 0 Newbie Poster

Hi,

I want to identify the datatypes of the te entire dataframe and group it as String, Number and Date.
Required Output:

 Attributes      Datatype
 A              String
 B              Number          
 C              String

As of now I am using the code:
for col_number in range(len(data_frame.columns)):

    datatype = data_frame[data_frame.columns[col_number]].apply(type).unique()[0]

    if (datatype is np.str or datatype is str) and data_frame.columns[col_number] != "DOP":
        fattr_dict[data_frame.columns[col_number]] = "String"
        elif datatype is np.int64 or datatype is np.int32 or datatype is float or datatype 
        is                    np.float64:
        fattr_dict[data_frame.columns[col_number]] = "Number"
    elif datatype is np.datetime64 or data_frame.columns[col_number] == "DOP":
        fattr_dict[data_frame.columns[col_number]] = "Date"

My question is how do I get the required format.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.