mirror of
https://github.com/qurator-spk/modstool.git
synced 2025-08-29 03:19:52 +02:00
🐛 Fix adding index columns as columns for MultiIndexes
This commit is contained in:
parent
18ad4fc854
commit
9eaac4d86d
1 changed files with 6 additions and 2 deletions
|
@ -423,7 +423,11 @@ def insert_into_db_multiple(con, table, ld: List[Dict]):
|
|||
def convert_db_to_parquet(con, table, index_col, output_file):
|
||||
df = pd.read_sql_query(f"SELECT * FROM {table}", con, index_col)
|
||||
|
||||
# Add index column as regular column, too
|
||||
# Add index column(s) as regular column(s), too
|
||||
if isinstance(df.index, pd.MultiIndex):
|
||||
for ic in index_col:
|
||||
df[ic] = df.index.get_level_values(ic)
|
||||
else:
|
||||
df[index_col] = df.index
|
||||
|
||||
# Convert Python column type into Pandas type
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue