Using df.dtypes
on my df gives me:
AccountKey int64
ParentAccountKey float64
AccountCodeAlternateKey int64
I only need the datatypes, and not the column names. How to get this?
I want to achieve something like this :
if datatypes contain 'varchar':
flag = 1
CodePudding user response:
The output of df.dtpyes
is a Series, just extract the values part.
df.dtypes.values
For the thing you want to achieve :
flag = [1 if x == "O" else 0 for x in df.dtypes.values ]