-
Notifications
You must be signed in to change notification settings - Fork 0
update_table(tname: str, df: pd.DataFrame)
Marcel Ferrari edited this page Feb 9, 2023
·
2 revisions
Updates the contents of an existing table in the database with the contents of a Pandas DataFrame.
update_table(tname: str, df: pd.DataFrame) -> None-
tname: name of the table to update. -
df: Pandas DataFrame containing the updated data.
# Connect to the database
db = PandaSQLiteDB("example.sql")
# Create a Pandas DataFrame with updated data
df = pd.DataFrame({
'column1': [1, 2, 3],
'column2': ['D', 'E', 'F']
})
# Update the contents of an existing table named "my_table"
db.update_table('my_table', df)