top of page
Search
  • Writer's picturenetznana

Useful panda dataframe functions

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.


  1. You can create an empty dataframe and then add new columns to it. Simply df['column_name'] = list , to get this done.

  2. 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!

  3. 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.




9 views0 comments

Recent Posts

See All

Reusability of codes

So I am working on my first project in analyzing a dataset using pandas dataframe and wrote a bunch of codes to carry this out. However,...

Feature Scaling

A given data set's features will differ in magnitudes and units. For example, a feature weight may vary between 80-200 pounds whereas...

Comments


bottom of page