diff --git a/camelot/parsers/hybrid.py b/camelot/parsers/hybrid.py index bfa4cf38..2fa447e2 100644 --- a/camelot/parsers/hybrid.py +++ b/camelot/parsers/hybrid.py @@ -1,7 +1,5 @@ """Implementation of hybrid table parser.""" -import numpy as np - from ..utils import bboxes_overlap from ..utils import boundaries_to_split_lines from .base import BaseParser @@ -158,10 +156,10 @@ def _generate_table(self, table_idx, bbox, cols, rows, **kwargs): table = parser._generate_table(table_idx, bbox, cols, rows, **kwargs) # Because hybrid can inject extraneous splits from both lattice and # network, remove lines / cols that are completely empty. - table.df = table.df.replace("", np.nan) - table.df = table.df.dropna(axis=0, how="all") - table.df = table.df.dropna(axis=1, how="all") - table.df = table.df.replace(np.nan, "") + # drop empty rows + table.df = table.df.loc[~(table.df == "").all(axis=1)] + # drop empty columns + table.df = table.df.loc[:, ~(table.df == "").all(axis=0)] table.shape = table.df.shape return table