25.5k views
4 votes
Create a new data frame that includes data from the year 1980 to the most recent year (2016) in the dataset How would I go about doing this

User Deepal
by
8.1k points

1 Answer

4 votes

Final answer:

To create a new data frame for a given year range, one would need to filter the dataset based on the year column to include only the desired years, and then create a new data frame with the filtered data, using a programming library such as pandas in Python.

Step-by-step explanation:

To create a new data frame that includes data from the year 1980 to the most recent year in the dataset, which is 2016, you would follow certain steps depending on the software or programming language you are using. Assuming you are working with a programming language like Python and a library like pandas, which is commonly used for data manipulation and analysis, you would:

  1. Load your dataset into a pandas data frame.
  2. Assuming the dataset has a column with the year for each data point, filter the data frame to only include rows where the year is greater than or equal to 1980 and less than or equal to 2016.
  3. Create a new data frame with this filtered data.

Graphs, such as the one you are referring to, are powerful tools to compress lots of data and provide a quick intuitive sense of the information. The graph you mentioned evidently includes monthly data points which contribute to the nearly 600 data points over the nearly 50 years from 1960.

Here is an example in Python code using pandas:

import pandas as pd
# Assuming 'df' is your original data frame and 'Year' is the column with years
new_df = df[(df['Year'] >= 1980) & (df['Year'] <= 2016)]

User Mpho
by
7.4k points