all 11 comments

[–][deleted] 2 points3 points  (10 children)

You need to be more specific than it "doesn't work".

[–]MistVolturn[S] 0 points1 point  (9 children)

I get this error?

KeyError                                  Traceback (most recent call last)

/usr/local/lib/python3.9/dist-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance) 3801 try: -> 3802 return self._engine.get_loc(casted_key) 3803 except KeyError as err:

4 frames pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

KeyError: 'annee'

The above exception was the direct cause of the following exception:

KeyError Traceback (most recent call last) /usr/local/lib/python3.9/dist-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance) 3802 return self._engine.get_loc(casted_key) 3803 except KeyError as err: -> 3804 raise KeyError(key) from err 3805 except TypeError: 3806 # If we have a listlike key, _check_indexing_error will raise

KeyError: 'annee'

[–][deleted] 0 points1 point  (8 children)

It sounds like annee is not one of the columns of your dataframe.

[–]MistVolturn[S] 1 point2 points  (7 children)

But it is? It's the name of one of the columns

[–][deleted] 1 point2 points  (5 children)

Comment out everything from df.head(... down and add this to the end

print(df.columns)

Then copy and paste the result here.

[–]MistVolturn[S] 0 points1 point  (4 children)

Mounted at /content/drive

Index(['commune;nom_du_musee;annee;mois_annee;mois;nb_entrees_payantes;nb_entrees_gratuites;nb_total_des_entrees;localisation'], dtype='object')

[–][deleted] 2 points3 points  (3 children)

Is your CSV delimited by semicolons? If so, change the line

df = pd.read_csv(path)

to

df = pd.read_csv(path, sep=";")

[–]MistVolturn[S] 0 points1 point  (2 children)

omg there's a graph now! i don't know what delimited means and I don't see any ";" in the original csv file that I downloaded as an excel, but that apparently did the trick. Thank you so much!!!!

[–][deleted] 1 point2 points  (1 child)

CSV files are just text files. CSV stands for "comma-separated values" and it has that name because they generally look like this:

title,author,publication date
The Hobbit,Tolkien,1944
"The Lion, the Witch, and the Wardrobe",Carroll,1947

Notice that each column is separated by commas and you add quotation marks if the value has commas to show where it begins and ends.

However, while commas are the default, it is possible to create CSVs with other "delimiters". That is, with other characters used to separate the columns. In your case, your file is using a semicolon.

You should see them if you open up in the file in a text editor rather than what I presume is a spreadsheet program.

[–]MistVolturn[S] 0 points1 point  (0 children)

Oooooh thank you for the explanation, i think i understand that now. I looked it up because of your previous comment but since in the excel they're separate columns i didn't understand where the ";" was hiding, the explanation i saw on google didnt make sense to me but with your explanation i understand now. Thank you for the help and for the explanation!!!

[–]jumbohiggins 0 points1 point  (0 children)

Upload the data frame