Graded Assignment 2: 4.1.2

5 months ago by
connect_1 = sqlite3.connect('oscars.db')
w4_clean.to_sql('oscars', connect_1, if_exists='replace', index=False)
query_clean_3 = '''
update oscars
set ceremonyday = 11
where ceremonyday = "eleven";
pd.read_sql_query(query_clean_3, connect_1)

TypeError Traceback (most recent call last)
<ipython-input-9-db6862d964af> in <module>()
22 where ceremonyday = "eleven";
23 '''
---> 24 pd.read_sql_query(query_clean_3, connect_1)
25 #w4_clean[w4_clean['CeremonyDay'] == "eleven"]

C:\ProgramData\Anaconda3\lib\site-packages\pandas\io\ in read_sql_query(sql, con, index_col, coerce_float, params, parse_dates, chunksize)
330 return pandas_sql.read_query(
331 sql, index_col=index_col, params=params, coerce_float=coerce_float,
--> 332 parse_dates=parse_dates, chunksize=chunksize)

C:\ProgramData\Anaconda3\lib\site-packages\pandas\io\ in read_query(self, sql, index_col, coerce_float, params, parse_dates, chunksize)
1438 args = _convert_params(sql, params)
1439 cursor = self.execute(*args)
-> 1440 columns = [col_desc[0] for col_desc in cursor.description]
1442 if chunksize is not None:

TypeError: 'NoneType' object is not iterable

1 Answer

5 months ago by
Next time try to be a bit more specific rather than just inserting your error message here. My advice here would be to read the question again and inspect the csv-data file carefully. Do we need to change the string data in the database file or the csv-file? And given this answer, should we use SQL or just a pandas function?
Please login to add an answer/comment or follow this question.

Similar posts:
Search »