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
0:05
that she can reference this in the future.
0:08
If you want to do math on a single column,
0:11
use the brackets. Put the column name in there.
0:13
In this example, you can do this sum or the average on the extended amount column
0:17
You can count or do number of unique values on a column.
0:24
If you want to do a frequency table and see how many products and how many
0:28
examples or instances of that product there are,
0:33
you can use value counts. And then,
0:35
if you want to add a new column in this example,
0:38
if you want to do a mathematical calculation in this example,
0:41
we multiply our extended amount times 0.15 or you can enter in a string.
0:46
And then pandas will make sure that everything is copied down,
0:51
essentially to all of the other values in the data frame.
0:56
And then, when you want to work with multiple columns,
0:59
you put a list inside the brackets,
1:01
and then this example will show the average for the price and the quantity,
1:06
and you can do this for as many columns as you want in your data frame