Skip to content

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.

Function

update_table(tname: str, df: pd.DataFrame) -> None
  • tname: name of the table to update.
  • df: Pandas DataFrame containing the updated data.

Example

# 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)

Clone this wiki locally