pandas can read data from any SQL databases that support Python data adapters, that respect the Python DB-API. Reading is performed using the
pandas.io.sql.read_sql() function and writing to SQL databases using the
.to_sql() method of
As an example of writing, the following reads the stock data from
aapl.csv. It then makes a connection to a SQLite3 database file. If the file does not exist, it creates it on the fly. It then writes the MSFT data to a table named
STOCK_DATA. If the table did not exist, it is created. If it exists, all the data is replaced with the MSFT data. It then appends the
AAPL stock data to that table:
In : # reference SQLite import sqlite3 # read in the ...