Skip to content

Commit 95a705c

Browse files
author
Chris Turner
committed
datajoint/table.py: smarter dataframe conversion
1 parent 98c0a81 commit 95a705c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

datajoint/table.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,9 @@ def insert(self, rows, replace=False, skip_duplicates=False, ignore_extra_fields
193193
"""
194194

195195
if isinstance(rows, pandas.DataFrame):
196-
rows = rows.to_records()
196+
rows = rows.reset_index(
197+
drop=isinstance(rows.index, pandas.RangeIndex)).to_records(
198+
index=False)
197199

198200
# prohibit direct inserts into auto-populated tables
199201
if not allow_direct_insert and not getattr(self, '_allow_insert', True): # allow_insert is only used in AutoPopulate

0 commit comments

Comments
 (0)