Skip to content

Commit 34cf263

Browse files
committed
fix: csv driver incorrectly putting 1st col as index
1 parent 1ded3d9 commit 34cf263

File tree

5 files changed

+14
-12
lines changed

5 files changed

+14
-12
lines changed

pins/boards.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -600,10 +600,12 @@ class BoardManual(BaseBoard):
600600
['df_csv']
601601
602602
>>> board.pin_read("df_csv")
603-
y z
604-
x
605-
1 a 3
606-
2 b 4
603+
x y z
604+
0 1 a 3
605+
1 2 b 4
606+
607+
608+
607609
608610
"""
609611

pins/constructors.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,10 +197,10 @@ def board_github(
197197
['df_arrow', 'df_csv', 'df_rds', 'df_unversioned']
198198
199199
>>> board.pin_read("df_csv")
200-
y z
201-
x
202-
1 a 3
203-
2 b 4
200+
x y z
201+
0 1 a 3
202+
1 2 b 4
203+
204204
205205
"""
206206

pins/drivers.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def load_data(
5757
if meta.type == "csv":
5858
import pandas as pd
5959

60-
return pd.read_csv(fs.open(path_to_file), index_col=0)
60+
return pd.read_csv(fs.open(path_to_file))
6161

6262
elif meta.type == "joblib":
6363
import joblib
@@ -90,7 +90,7 @@ def save_data(
9090
raise NotImplementedError(
9191
"Currently only pandas.DataFrame can be saved to a CSV."
9292
)
93-
obj.to_csv(fname)
93+
obj.to_csv(fname, index=False)
9494
elif type == "joblib":
9595
import joblib
9696

pins/tests/test_compat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def test_compat_pin_read(board):
133133
p_data = PATH_TO_EXAMPLE_BOARD / "df_csv" / "20220214T163720Z-9bfad" / "df_csv.csv"
134134

135135
src_df = board.pin_read("df_csv")
136-
dst_df = pd.read_csv(p_data, index_col=0)
136+
dst_df = pd.read_csv(p_data)
137137

138138
assert isinstance(src_df, pd.DataFrame)
139139
assert src_df.equals(dst_df)

pins/tests/test_constructors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
@pytest.fixture
1818
def df_csv():
19-
return pd.read_csv(PATH_TO_EXAMPLE_VERSION / "df_csv.csv", index_col=0)
19+
return pd.read_csv(PATH_TO_EXAMPLE_VERSION / "df_csv.csv")
2020

2121

2222
def check_dir_writable(p_dir):

0 commit comments

Comments
 (0)