I have the following DF:
col1 col2
1 2017-01-03 2018-03-30 08:01:32
2 2017-01-04 2018-03-30 08:02:32
If I do df.dtypes, I get get the following output:
col1 datetime64[ns]
col2 datetime64[ns]
dtype: object
Howeverm col1 contains Only Date information (DATE), whereas col2 contains both date and time information (DATETIME).
Whats the easiest way to determine wheter a column contains DATE or DATETIME information?
Data generation:
import pandas as pd
# Generate the df
col1 = ["2017-01-03", "2017-01-04"]
col2 = ["2018-03-30 08:01:32", "2018-03-30 08:02:32"]
df = pd.DataFrame({"col1": col1, "col2": col2})
df["col1"] = pd.to_datetime(df["col1"])
df["col2"] = pd.to_datetime(df["col2"])