I try to compile this code but I get this errror :
NameError: name 'dtype' is not defined
Here is the python code :
# -*- coding: utf-8 -*- from __future__ import division import pandas as pd import numpy as np import re import missingno as msno from functools import partial import seaborn as sns sns.set(color_codes=True) if dtype(data.OPP_CREATION_DATE)=="datetime64[ns]": print("OPP_CREATION_DATE is of datetime type") else: print("warning: the type of OPP_CREATION_DATE is not datetime, please fix this")
Any idea please to help me to resolve this problem?
As written by Amr Keleg,
datais a pandas dataframe then you can check the type of a
column as follows:
In that case you need e.g.
df['colname'].dtype == np.dtype('datetime64')
df.colname.dtype == np.dtype('datetime64')
Answered By – ntg
Answer Checked By – Willingham (BugsFixing Volunteer)