From 5df67a728a481d1709c9cd1f0e1ba2f2af9c4497 Mon Sep 17 00:00:00 2001 From: ljnsn <82611987+ljnsn@users.noreply.github.com> Date: Wed, 16 Nov 2022 00:12:38 +0100 Subject: [PATCH] Simplify skiprows. We're currently not doing any input validation. It might make sense to add, but then at the top level function. --- pandas_ods_reader/algo.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/pandas_ods_reader/algo.py b/pandas_ods_reader/algo.py index cbf2c31..07e9178 100644 --- a/pandas_ods_reader/algo.py +++ b/pandas_ods_reader/algo.py @@ -5,16 +5,11 @@ import pandas as pd 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() col_index = {} - if skiprows is not None: - if isinstance(skiprows, int): - for _ in range(skiprows): - next(rows) - else: - message = f"'skiprows' must be int. {type(skiprows)} was given." - raise ValueError(message) + for _ in range(skiprows): + next(rows) for i, row in enumerate(rows): # row is a list of cells if headers and i == 0 and not columns: