0
$\begingroup$

I want 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 want to convert those fields to DateTime. In short, I want 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.