Skip to content

Tag: dataframe

Merge two dataframes with subheaders

So I have my first dataframe that has countries as headers and infected and death values as subheaders, then I have my second dataframe, I want to merge the dataframes so that the indicator columns become subheaders of the countries column like in df with the infected and dead subheaders. What I want to produ…

convert month of dates into sequence

i want to combine months from years into sequence, for example, i have dataframe like this: i want to sequence the months of the date. the desired output is: which means feb’15 is the first month in the date list and jan’2016 is the 12th month after feb’2015 Answer If your date column is a d…