Skip to content

Commit 2a750db

Browse files
author
Marvin Klerx
committed
fix: fixed duplicated removal of first index / header
1 parent ca170ca commit 2a750db

File tree

4 files changed

+174
-2
lines changed

4 files changed

+174
-2
lines changed

src/Tables/utils/file_reader.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ def convert_dataframe(
4343
if self.file_type == FileType.Parquet and not self.ignore_header:
4444
list_data.insert(0, list(data.columns))
4545

46-
if self.ignore_header and self.file_type != FileType.Parquet:
47-
return list_data[1:]
4846
return list_data
4947
if return_type == TableFormat["List of dicts"]:
5048
df_for_dicts = data

tests/atest/test_reader.robot

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,61 @@ Read Row Count - CSV - With Header
107107
${row_count} Tables.Count Table ${file_path} Rows
108108
BuiltIn.Should Be Equal ${row_count} ${6}
109109

110+
111+
# Check reading and opening of CSV file with ignore header true and false
112+
CSV has Headers - Read CSV Table and Ignore Header
113+
Tables.Configure Ignore Header ${True}
114+
Tables.Count Table ${CURDIR}${/}testdata${/}example_07.csv Rows == ${57}
115+
${data} = Tables.Read Table ${CURDIR}${/}testdata${/}example_07.csv
116+
Length Should Be ${data} ${57}
117+
118+
CSV has Headers - Open CSV Table and Ignore Header
119+
Tables.Configure Ignore Header ${True}
120+
${alias} = Tables.Open Table ${CURDIR}${/}testdata${/}example_07.csv
121+
Tables.Count Table ${alias} Rows == ${57}
122+
${data} = Tables.Get Table
123+
Length Should Be ${data} ${57}
124+
125+
CSV has Headers - Read CSV Table and Not Ignore Header
126+
Tables.Configure Ignore Header ${False}
127+
Tables.Count Table ${CURDIR}${/}testdata${/}example_07.csv Rows == ${58}
128+
${data} = Tables.Read Table ${CURDIR}${/}testdata${/}example_07.csv
129+
Length Should Be ${data} ${58}
130+
131+
CSV has Headers - Open CSV Table and Not Ignore Header
132+
Tables.Configure Ignore Header ${False}
133+
${alias} = Tables.Open Table ${CURDIR}${/}testdata${/}example_07.csv
134+
Tables.Count Table ${alias} Rows == ${58}
135+
${data} = Tables.Get Table
136+
Length Should Be ${data} ${58}
137+
138+
# No headers in file!
139+
CSV has No Headers - Read CSV Table and Ignore Header
140+
Tables.Configure Ignore Header ${True}
141+
Tables.Count Table ${CURDIR}${/}testdata${/}example_08.csv Rows == ${56}
142+
${data} = Tables.Read Table ${CURDIR}${/}testdata${/}example_08.csv
143+
Length Should Be ${data} ${56}
144+
145+
CSV has No Headers - Open CSV Table and Ignore Header
146+
Tables.Configure Ignore Header ${True}
147+
${alias} = Tables.Open Table ${CURDIR}${/}testdata${/}example_08.csv
148+
Tables.Count Table ${alias} Rows == ${56}
149+
${data} = Tables.Get Table
150+
Length Should Be ${data} ${56}
151+
152+
CSV has No Headers - Read CSV Table and Not Ignore Header
153+
Tables.Configure Ignore Header ${False}
154+
Tables.Count Table ${CURDIR}${/}testdata${/}example_08.csv Rows == ${57}
155+
${data} = Tables.Read Table ${CURDIR}${/}testdata${/}example_08.csv
156+
Length Should Be ${data} ${57}
157+
158+
CSV has No Headers - Open CSV Table and Not Ignore Header
159+
Tables.Configure Ignore Header ${False}
160+
${alias} = Tables.Open Table ${CURDIR}${/}testdata${/}example_08.csv
161+
Tables.Count Table ${alias} Rows == ${57}
162+
${data} = Tables.Get Table
163+
Length Should Be ${data} ${57}
164+
110165
########################################################################################
111166
# TXT
112167
########################################################################################
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
Timestamp,Value
2+
2025-11-14T12:56:00.742Z,-0.58778524
3+
2025-11-14T12:56:01.741Z,-2.4492937e-16
4+
2025-11-14T12:56:02.742Z,0.58778524
5+
2025-11-14T12:56:03.742Z,0.95105654
6+
2025-11-14T12:56:04.742Z,0.95105654
7+
2025-11-14T12:56:07.34Z,0.58778524
8+
2025-11-14T12:56:08.34Z,1.2246469e-16
9+
2025-11-14T12:56:09.34Z,-0.58778524
10+
2025-11-14T12:56:10.34Z,-0.95105654
11+
2025-11-14T12:56:11.339Z,-0.95105654
12+
2025-11-14T12:56:12.339Z,-0.58778524
13+
2025-11-14T12:56:13.34Z,-2.4492937e-16
14+
2025-11-14T12:56:14.34Z,0.58778524
15+
2025-11-14T12:56:15.34Z,0.95105654
16+
2025-11-14T12:56:16.339Z,0.95105654
17+
2025-11-14T12:56:17.34Z,0.58778524
18+
2025-11-14T12:56:18.339Z,1.2246469e-16
19+
2025-11-14T12:56:19.34Z,-0.58778524
20+
2025-11-14T12:56:20.34Z,-0.95105654
21+
2025-11-14T12:56:21.34Z,-0.95105654
22+
2025-11-14T12:56:22.339Z,-0.58778524
23+
2025-11-14T12:56:23.34Z,-2.4492937e-16
24+
2025-11-14T12:56:24.34Z,0.58778524
25+
2025-11-14T12:56:25.339Z,0.95105654
26+
2025-11-14T12:56:26.34Z,0.95105654
27+
2025-11-14T12:56:27.34Z,0.58778524
28+
2025-11-14T12:56:28.34Z,1.2246469e-16
29+
2025-11-14T12:56:29.34Z,-0.58778524
30+
2025-11-14T12:56:30.34Z,-0.95105654
31+
2025-11-14T12:56:31.34Z,-0.95105654
32+
2025-11-14T12:56:32.34Z,-0.58778524
33+
2025-11-14T12:56:33.34Z,-2.4492937e-16
34+
2025-11-14T12:56:34.34Z,0.58778524
35+
2025-11-14T12:56:35.34Z,0.95105654
36+
2025-11-14T12:56:36.339Z,0.95105654
37+
2025-11-14T12:56:37.339Z,0.58778524
38+
2025-11-14T12:56:38.339Z,1.2246469e-16
39+
2025-11-14T12:56:40.935Z,-0.58778524
40+
2025-11-14T12:56:41.934Z,-0.95105654
41+
2025-11-14T12:56:42.935Z,-0.95105654
42+
2025-11-14T12:56:43.935Z,-0.58778524
43+
2025-11-14T12:56:44.935Z,-2.4492937e-16
44+
2025-11-14T12:56:45.935Z,0.58778524
45+
2025-11-14T12:56:46.934Z,0.95105654
46+
2025-11-14T12:56:47.935Z,0.95105654
47+
2025-11-14T12:56:48.935Z,0.58778524
48+
2025-11-14T12:56:49.934Z,1.2246469e-16
49+
2025-11-14T12:56:50.935Z,-0.58778524
50+
2025-11-14T12:56:51.934Z,-0.95105654
51+
2025-11-14T12:56:52.934Z,-0.95105654
52+
2025-11-14T12:56:53.934Z,-0.58778524
53+
2025-11-14T12:56:54.934Z,-2.4492937e-16
54+
2025-11-14T12:56:55.935Z,0.58778524
55+
2025-11-14T12:56:56.935Z,0.95105654
56+
2025-11-14T12:56:57.935Z,0.95105654
57+
2025-11-14T12:56:58.936Z,0.58778524
58+
2025-11-14T12:56:59.935Z,1.2246469e-16
59+
60+
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
2025-11-14T12:56:00.742Z,-0.58778524
2+
2025-11-14T12:56:01.741Z,-2.4492937e-16
3+
2025-11-14T12:56:02.742Z,0.58778524
4+
2025-11-14T12:56:03.742Z,0.95105654
5+
2025-11-14T12:56:04.742Z,0.95105654
6+
2025-11-14T12:56:07.34Z,0.58778524
7+
2025-11-14T12:56:08.34Z,1.2246469e-16
8+
2025-11-14T12:56:09.34Z,-0.58778524
9+
2025-11-14T12:56:10.34Z,-0.95105654
10+
2025-11-14T12:56:11.339Z,-0.95105654
11+
2025-11-14T12:56:12.339Z,-0.58778524
12+
2025-11-14T12:56:13.34Z,-2.4492937e-16
13+
2025-11-14T12:56:14.34Z,0.58778524
14+
2025-11-14T12:56:15.34Z,0.95105654
15+
2025-11-14T12:56:16.339Z,0.95105654
16+
2025-11-14T12:56:17.34Z,0.58778524
17+
2025-11-14T12:56:18.339Z,1.2246469e-16
18+
2025-11-14T12:56:19.34Z,-0.58778524
19+
2025-11-14T12:56:20.34Z,-0.95105654
20+
2025-11-14T12:56:21.34Z,-0.95105654
21+
2025-11-14T12:56:22.339Z,-0.58778524
22+
2025-11-14T12:56:23.34Z,-2.4492937e-16
23+
2025-11-14T12:56:24.34Z,0.58778524
24+
2025-11-14T12:56:25.339Z,0.95105654
25+
2025-11-14T12:56:26.34Z,0.95105654
26+
2025-11-14T12:56:27.34Z,0.58778524
27+
2025-11-14T12:56:28.34Z,1.2246469e-16
28+
2025-11-14T12:56:29.34Z,-0.58778524
29+
2025-11-14T12:56:30.34Z,-0.95105654
30+
2025-11-14T12:56:31.34Z,-0.95105654
31+
2025-11-14T12:56:32.34Z,-0.58778524
32+
2025-11-14T12:56:33.34Z,-2.4492937e-16
33+
2025-11-14T12:56:34.34Z,0.58778524
34+
2025-11-14T12:56:35.34Z,0.95105654
35+
2025-11-14T12:56:36.339Z,0.95105654
36+
2025-11-14T12:56:37.339Z,0.58778524
37+
2025-11-14T12:56:38.339Z,1.2246469e-16
38+
2025-11-14T12:56:40.935Z,-0.58778524
39+
2025-11-14T12:56:41.934Z,-0.95105654
40+
2025-11-14T12:56:42.935Z,-0.95105654
41+
2025-11-14T12:56:43.935Z,-0.58778524
42+
2025-11-14T12:56:44.935Z,-2.4492937e-16
43+
2025-11-14T12:56:45.935Z,0.58778524
44+
2025-11-14T12:56:46.934Z,0.95105654
45+
2025-11-14T12:56:47.935Z,0.95105654
46+
2025-11-14T12:56:48.935Z,0.58778524
47+
2025-11-14T12:56:49.934Z,1.2246469e-16
48+
2025-11-14T12:56:50.935Z,-0.58778524
49+
2025-11-14T12:56:51.934Z,-0.95105654
50+
2025-11-14T12:56:52.934Z,-0.95105654
51+
2025-11-14T12:56:53.934Z,-0.58778524
52+
2025-11-14T12:56:54.934Z,-2.4492937e-16
53+
2025-11-14T12:56:55.935Z,0.58778524
54+
2025-11-14T12:56:56.935Z,0.95105654
55+
2025-11-14T12:56:57.935Z,0.95105654
56+
2025-11-14T12:56:58.936Z,0.58778524
57+
2025-11-14T12:56:59.935Z,1.2246469e-16
58+
59+

0 commit comments

Comments
 (0)