.. _database: Input/output examples: csv files and database ================================================= .. contents:: :depth: 3 :local: :backlinks: entry Read from csv file, write to database ---------------------------------------- First, we read the data from the following csv file. .. csv-table:: :file: historicalPrices.csv Then we insert the table in a database, following https://docs.python.org/3.3/library/sqlite3.html .. plot:: database/databaseWrite.py :include-source: Read from database, save to a new csv file ------------------------------------------- Finally, we read the table from the database, in a new Python session and print it to a csv file, after we swap two columns and format the data. .. plot:: database/databaseRead.py :include-source: .. csv-table:: :file: historicalPrices2.csv