October 2019
Beginner to intermediate
674 pages
16h 43m
English
With support from the sqlalchemy package, data can be transferred to databases through pandas:
from sqlalchemy import create_engineengine = create_engine('sqlite:///:memory:')df.to_sql('data_sql',engine)
Data can also be pushed iteratively in batches by using the chunksize argument.
The data type of any column can also be changed when pushing to the database, as shown in the following code:
from sqlalchemy.types import Stringdf.to_sql('data_dtype', engine, dtype={'Score': String})
The Timedelta datatype, which is not supported across databases, is converted into its equivalent integral value in nanoseconds before being stored in the database.
Read now
Unlock full access