Skip to content

Commit 4c1738d

Browse files
committed
fix: correct kwargs for reading csv with narwhals for peptide pool data
1 parent 5b8c221 commit 4c1738d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

hdxms_datasets/reader.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,13 @@ def read_hdexaminer_peptide_pool(source: Path | StringIO) -> nw.DataFrame:
127127
header_line = source.readline()
128128

129129
else:
130-
df = nw.read_csv(
131-
source.as_posix(), backend=BACKEND, skip_rows=1, has_header=True
132-
)
130+
kwargs = {
131+
"polars": {"skip_rows": 1, "has_header": True},
132+
"pandas": {"skiprows": [0]},
133+
}
134+
if BACKEND not in kwargs:
135+
raise ValueError(f"Unsupported backend: {BACKEND}")
136+
df = nw.read_csv(source.as_posix(), backend=BACKEND, **kwargs[BACKEND])
133137
with open(source, "r") as fh:
134138
exposure_line = fh.readline()
135139
header_line = fh.readline()

0 commit comments

Comments
 (0)