Sofia
Sofia

Reputation: 1

TypeError: Cannot do positional indexing on RangeIndex with these indexers of type DataFrame

I'm new with python so I'm sorry if this is a basic one. However, after I ran the code, I got this:

TypeError: cannot do positional indexing on RangeIndex with these indexers [   Year  Average of PM Concentration (µg/Ncm)  Annual Guidline Value{µg/Ncm)
0  2012                                  51.0                             60
1  2013                                  49.0                             60
2  2014                                  27.0                             60
3  2015                                  45.5                             60
4  2016                                  59.0                             60
5  2017                                  62.0                             60
6  2018                                  62.0                             60
7  2019                                  57.0                             60] of type DataFrame

This is the code:

import pandas as pd

# Load the dataset from the Downloads folder
data = pd.read_csv('Group2Data.csv')

# Display the first 8 rows of the dataset
print(data.head(8))

I really don't know what went wrong. Can anyone help me please?

Upvotes: 0

Views: 36

Answers (0)

Related Questions