I have a dataset, say:
DateJoined Name Number DateLeft
11/03/2015 Tom 001199 11/03/2019
11/03/2016 Bil 001197 12/03/2019
11/03/2017 Mat 001196 13/03/2019
11/03/2018 Jon 001195 14/03/2019
I want to only select the columns that have a date and change the format of all the dates within that column to Month/Date/Year.
I've already tried playing around with the code like this, but it comes up with errors.
date_cols=[col for col in dataset.columns if 'date' in col]
for col in dataset[date_cols]:
for row in dataset[date_cols]:
dataset[date_cols]=pd.to_datetime(dataset[date_cols]).dt.strftime('%d-%m-%Y')
next(row)
next(col)
Any help would be appreciated. I'm still new to pandas and python
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)