I'm Lucas and I'm a master student in management science in Belgium. I have a very poor background in coding and everything related to it, so my problem is probably very basic but still very confusing for me. This semester, I follow a course named "Data management and business analytics". For the purpose of a little group work, we are required to use python and the package pandasql. We are supposed to import csv files in google colab and to do some queries to only get what we need, then we need to export the "transformed" data frame in excel and do some graphs. Here is the problem, I managed to import a first csv file, to do a simple query on a first data frame created on the basis of this csv using pandas, even to export it on excel. However, I tried to do the exact same thing on a second csv file, but I keep getting the same error message.
So, more precisely, I imported 3 csv files. The three are well imported and I can visualize their rows and columns without any problem. I named each data frame df, df1 and df2, and the result of the query on each of them result_df
, result_df1
, result_df2
. The problem starts with df1. In this data frame, there are columns named Year, Country, Model, etc. For example, when I write the following basic query: result_df1 = pysql("select Year from df1")
, the following error message appears: OperationalError: no such column: Year
. I checked several times the names of the different columns, but I can't find the reason why it doesn't recognize the columns whereas they really exist in the data frame df1. The exact same problem occurs with df2 which has the exact same columns as df1.
I hope that someone will be able to help me, It would be a relief .
If you need more details to help me, don't hesitate to ask!
Thanks in advance! (and sorry if my English seems bad)