Are you missing data specified in a funny way?
Pandas can help with that! Specify how missing values are formatted:
3
Have a massive Pandas DataFrame?
The category data type can help! If you have categorical data, read those columns as a category type:
1
My new video on styling Pandas DataFrames is up! Learn to add style, colour, and bars to Pandas 🥳 youtu.be/JGefS6WPm1E
3
#Python provides handy ways to add items to a list:
👉 .append() adds a single item
👉 .extend() adds multiple items
1
Nice! That's a good solution! It may be slow when you're working with large datasets (since you're converting to a list and iterating over each item).
Check out the two options below, which should run faster. 😊
The conditional column explained: datagy.io/pandas-conditional…
5/6 But... wait... why am I suggesting we use a longer way of doing something? It doesn't actually need to be longer! Let's recreate it with a lambda function!
1
4/6 Now, this works, but I find the 𝘪𝘯𝘵𝘦𝘯𝘵𝘪𝘰𝘯𝘢𝘭𝘪𝘵𝘺 of the code isn't quite well explained. When we use the filter() function, we're explicitly saying that we want to filter a list.
Let's see how we can use it!
1
3/6 But, wait... we have to define an empty list first? Yikes! Let's take a look at how we can do this with a list comprehension:
1
2/6 Before learning about this function, I was always filtering lists with for loops.
In the example below, we filter a list to only include even numbers:
1
One of my favorite #Python functions is the filter() function! It lets you... wait for it... filter things!
Let's talk about it in this Python thread 🐍🧵
1
2
Need to add some row and column totals to a static table in #Python Pandas? You can do this with using the sum function across different axes!
2
When reading an Excel file into a #Python Pandas DataFrame, you may be used to specifying column names to read in.
Did you know you can also specify Excel ranges too? 🤯














