I have a pandas DataFrame with 18 columns and about 10000 rows.
My first 3 columns have separate values for YEAR, MONTH, and DAY. I need to merge these three columns and have the entire date in one column for all the rows.
My code so far is:
df.merge('Year','/','Month')
You are looking for
apply(mergeis like a database join.):The
axis=1part means you are selecting columns rather than row.If you wanted to give a specific date you could use datetime:
You can add these as columns in you dataframe as follows:
.
It’s worth noting that pandas has an easy way to
parse_dateswhen reading as a csv.