October 2014
Beginner to intermediate
348 pages
6h 55m
English
We can give pandas a database connection such as the one in the previous example or a SQLAlchemy connection. We will cover the latter in the later sections of this chapter. We will load the statsmodels sunactivity data, just like in the previous chapter, Chapter 7, Signal Processing and Time Series:
DataFrame:rows = [tuple(x) for x in df.values]
Contrary to the previous example, create a table without specifying data types:
con.execute("CREATE TABLE sunspots(year, sunactivity)")executemany() method executes multiple statements; in this case, we will be inserting records from a list of tuples. Insert all the rows into the table and show the row count as follows:con.executemany("INSERT ...Read now
Unlock full access