Issue
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? Thank you
Solution
As written by Amr Keleg,
If
data
is a pandas dataframe then you can check the type of a column as follows:
df['colname'].dtype
ordf.colname.dtype
In that case you need e.g.
df['colname'].dtype == np.dtype('datetime64')
or
df.colname.dtype == np.dtype('datetime64')
Answered By - ntg
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.