Pandas has being having a swell week. “It appears someone has been reading my help documentation”, pd thought out loud. Just then the from_dict attribute is called to create a dataframe for DataGist.
The dataframe structure looked kinda off, pd thought. Was it how the dataframe was created? Would it be easier to have a list out of the dict, create a df as dataframe is commonly called and append? Efficiency is key here…DE calls pd helpline…🙂
Now and again someone wants to change the structure of the dataframe. This is to help achieve a particular view instead of having data_gist_df[‘season’], the DE can call data_gist_df[‘season’]
Any idea on how this can be fixed? Some googling and StackOverflow options seem to be just a lot for a simple transpose. Oh, wait! Pandas package has a transpose attribute. Awesome sauce!!!!
data_gist_df.transpose() to the rescue.
The transpose() function as the name implies writes the columns as rows or rows as columns, all depending on what the user wants. One of the many cool attributes of pandas.