Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions camelot/parsers/hybrid.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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

Expand Down
Loading