0
$\begingroup$

I would like to define a function that takes in a pandas dateframe and iterates through its columns to find if there is any date field or a timestamp which can be an object.

I would then like to convert those fields to DateTime.

In short, I would like to clean my different dataframes which can come from different sources and have different timestamps and store them.

Can you guys point me in the right direction?

def dateConversion(flattenedObject):
    for col in df.columns:
        df[col]=pd.to_datetime(df[col])
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.