Python Classes
  • Course Outline
  • Course Organization
  • Material
    • Week 1
    • Week 2
      • Extensions
    • Week 3
      • Extensions
    • Week 4
    • Week 5
      • Extensions
    • Week 6
      • Extensions
    • Week 7
    • Numpy
    • Matplot
    • Pandas
    • Week 10
    • Week 11
  • Exercises
    • Week 1
    • Week 2
    • Week 3
    • Week 4
    • Week 5
    • Week 6
    • Week 7
    • Matplotlib
    • Numpy
    • Pandas
    • Matplot with Numpy
  • Solutions
    • Week 2
    • Week 3
    • Week 4
    • Week 5
    • Week 6
    • Week 7
  • Additional
    • More Resources
    • Setting up Python
  • Lectures
    • Slides
    • Recordings
Powered by GitBook
On this page
  • Create DataFrame
  • Graph From File
  • Filtered Graph

Was this helpful?

  1. Exercises

Pandas

PreviousNumpyNextMatplot with Numpy

Last updated 5 years ago

Was this helpful?

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.

603B
pandas_file.csv
Pandas exercise file