Pandas

Create DataFrame

Use the range functions we have looked at previously to create a DataFrame with three columns, the first column should contain the number 1-10 (inclusive), the second should contain the numbers 11-20, and the final column should contain 21-30. Give each column a suitable name. Finally, print out the DataFrame, followed by each column printed separately.

Graph From File

Load the attached file into a DataFrame, then create a new DataFrame that contains only the first 20 rows. Then create a scatter plot using the first and third columns.

Note: the file does not contain any column headers, you'll need to make sure you tell Python what to call each of your columns when you create the first DataFrame.

Filtered Graph

Create a graph as before in the previous exercise, but this time instead of only the first rows, use all the rows where the third column is larger than the first column.

Last updated