Move from Excel to Python with Pandas Transcripts
Chapter: Intro to Pandas
Lecture: Concept: Working with columns

Login or purchase this course to watch this video and the rest of the course contents.
0:00 Now let's summarize some of the column work that we did in the previous exercise so that she can reference this in the future.
0:09 If you want to do math on a single column, use the brackets. Put the column name in there.
0:14 In this example, you can do this sum or the average on the extended amount column You can count or do number of unique values on a column.
0:25 If you want to do a frequency table and see how many products and how many examples or instances of that product there are,
0:34 you can use value counts. And then, if you want to add a new column in this example, if you want to do a mathematical calculation in this example,
0:42 we multiply our extended amount times 0.15 or you can enter in a string. And then pandas will make sure that everything is copied down,
0:52 essentially to all of the other values in the data frame. And then, when you want to work with multiple columns, you put a list inside the brackets,
1:02 and then this example will show the average for the price and the quantity, and you can do this for as many columns as you want in your data frame

Talk Python's Mastodon Michael Kennedy's Mastodon