Simplify skiprows. We're currently not doing any input validation.
It might make sense to add, but then at the top level function.
This commit is contained in:
parent
e88ac035a2
commit
5df67a728a
|
|
@ -5,16 +5,11 @@ import pandas as pd
|
||||||
from .utils import sanitize_df
|
from .utils import sanitize_df
|
||||||
|
|
||||||
|
|
||||||
def parse_data(backend, rows, headers=True, columns=None, skiprows=None):
|
def parse_data(backend, rows, headers=True, columns=None, skiprows=0):
|
||||||
df_dict = OrderedDict()
|
df_dict = OrderedDict()
|
||||||
col_index = {}
|
col_index = {}
|
||||||
if skiprows is not None:
|
for _ in range(skiprows):
|
||||||
if isinstance(skiprows, int):
|
next(rows)
|
||||||
for _ in range(skiprows):
|
|
||||||
next(rows)
|
|
||||||
else:
|
|
||||||
message = f"'skiprows' must be int. {type(skiprows)} was given."
|
|
||||||
raise ValueError(message)
|
|
||||||
for i, row in enumerate(rows):
|
for i, row in enumerate(rows):
|
||||||
# row is a list of cells
|
# row is a list of cells
|
||||||
if headers and i == 0 and not columns:
|
if headers and i == 0 and not columns:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue