Skip to content

Instantly share code, notes, and snippets.

@karanjagota karanjagota/ Secret
Created Jul 5, 2019

What would you like to do?
gist for medium blogs ..
data = {'gold':['day1','day2','day3','day4','day5'],
# converting data into dataframe ..
horizontal_df = pd.DataFrame(data)
# selecting the first 6 rows ..
# Reshaping it to a different format ..
vertical_df = new_df.melt(id_vars='gold',value_vars=['2015','2016','2017','2018']) # or
vertical_df_2 = horizontal_df.melt(id_vars='gold')
# selecting the first six rows of new data frame which is in a vertical format ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.