So recently I happened to code a function for a dataframe and it took me almost 4 hours to get it done. The pseudo code was simple, but I was struggling with it due to my lack of knowledge in manipulating dataframes.
Here are some important learnings from that experience.
You can create an empty dataframe and then add new columns to it. Simply df['column_name'] = list , to get this done.
If you have a panda series and you want to convert it to a list, simple use, df['column name'].tolist() to do so. I found this functionality extremely useful!
If you want to join two dataframes there are many ways to do so. Depending on what you are trying to achieve, you can use Merge, join, append, concatenate and compare.
I was intimidated by pandas as a novice. However, the more I learn about its methods and flexibility, the more I grow into it. Also another big advantage of using dataframes is that you can use seaborn on your dataframe to do the plotting. Plotting with seaborn could be intimidating at first but just like pandas (and anything else in life) the more you work with it, the better you get at using them.
Comments