Skip to content

Commit

Permalink
fix(api): make sure column names that are already inferred are not ov…
Browse files Browse the repository at this point in the history
…erwritten
  • Loading branch information
cpcloud authored and kszucs committed Aug 25, 2022
1 parent 1e8a18f commit 6f1cb16
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ibis/expr/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,8 +431,10 @@ def memtable(
"pass one or the other but not both"
)
df = pd.DataFrame(data, columns=columns)
if isinstance(data, (list, tuple)) and columns is None:
df = df.rename(columns={col: f"col{col:d}" for col in df.columns})
if df.columns.inferred_type != "string":
df = df.rename(
columns={col: f"col{i:d}" for i, col in enumerate(df.columns)}
)
return memtable(df, name=name, schema=schema)


Expand Down

0 comments on commit 6f1cb16

Please sign in to comment.