mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-05-14 19:43:41 +02:00
fix: pandas.to_sql does not write an index to the db anymore, docs
extended, test added.
This commit is contained in:
parent
504a8f3486
commit
845b4e60ac
2 changed files with 13 additions and 3 deletions
|
@ -8,7 +8,7 @@ from .json import create_json_string, import_json_string
|
|||
|
||||
|
||||
def to_sql(df, table_name, db, if_exists="replace", gz=True):
|
||||
"""Write DataFrame inlcuding Obs or Corr valued columns to sqlite database.
|
||||
"""Write DataFrame including Obs or Corr valued columns to sqlite database.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
@ -25,12 +25,12 @@ def to_sql(df, table_name, db, if_exists="replace", gz=True):
|
|||
"""
|
||||
se_df = _serialize_df(df, gz=gz)
|
||||
con = sqlite3.connect(db)
|
||||
se_df.to_sql(table_name, con, if_exists=if_exists)
|
||||
se_df.to_sql(table_name, con, if_exists=if_exists, index=False)
|
||||
con.close()
|
||||
|
||||
|
||||
def read_sql_query(sql, db, auto_gamma=False):
|
||||
"""Write DataFrame inlcuding Obs or Corr valued columns to sqlite database.
|
||||
"""Execute SQL query on sqlite database and obatin DataFrame including Obs or Corr valued columns.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue