Skip to content

Commit 60bedfe

Browse files
authored
ENH Adds column name validation to pandas implementation (#58)
1 parent 698989b commit 60bedfe

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

protocol/pandas_implementation.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ def _from_dataframe(df : DataFrameObject) -> pd.DataFrame:
6666
_k = _DtypeKind
6767
_buffers = [] # hold on to buffers, keeps memory alive
6868
for name in df.column_names():
69+
if not isinstance(name, str):
70+
raise ValueError(f"Column {name} is not a string")
71+
if name in columns:
72+
raise ValueError(f"Column {name} is not unique")
6973
col = df.get_column_by_name(name)
7074
if col.dtype[0] in (_k.INT, _k.UINT, _k.FLOAT, _k.BOOL):
7175
# Simple numerical or bool dtype, turn into numpy array

0 commit comments

Comments
 (0)