I am reading csv and I do not want the dataypes of columns as object, they should be int, float, str etc.
data = pd.read_csv(file_path+files, delimiter='\t', error_bad_lines=False)
data.dtypes:
Time object
Code int64
Address object
dtype: object
Is there any way that we could read datatypes originally as they are from csv while reading:
Expected:
data.dtypes:
Time int
Code int64
Address str
I have a dataframe that looks like:
df:
A B C
abc 10 20
def 30 50
cfg 90 60
pqr str 50
xyz 75 56
I want to get rid of the row where column 'B' is not 'int'. As the dtype of B is set as 'object' I am unable to do so.