Skip to content
This repository was archived by the owner on Apr 11, 2025. It is now read-only.

Commit 4c6720e

Browse files
committed
[REF] np.isclose to math.isclose
1 parent 84692c8 commit 4c6720e

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

camelot/parsers/base.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
"""Defines a base parser. As well as generic methods for other parsers."""
22

3+
import math
34
import os
45
import warnings
56

6-
import numpy as np
77
import pandas as pd
88

99
from ..core import Table
@@ -321,7 +321,7 @@ def _group_rows(text, row_tol=2):
321321
# if type(obj) is LTChar]):
322322
if row_y is None:
323323
row_y = t.y0
324-
elif not np.isclose(row_y, t.y0, atol=row_tol):
324+
elif not math.isclose(row_y, t.y0, abs_tol=row_tol):
325325
rows.append(sorted(temp, key=lambda t: t.x0))
326326
temp = []
327327
# We update the row's bottom as we go, to be forgiving if there
@@ -354,8 +354,8 @@ def _merge_columns(cl, column_tol=0):
354354
else:
355355
lower = merged[-1]
356356
if column_tol >= 0:
357-
if higher[0] <= lower[1] or np.isclose(
358-
higher[0], lower[1], atol=column_tol
357+
if higher[0] <= lower[1] or math.isclose(
358+
higher[0], lower[1], abs_tol=column_tol
359359
):
360360
upper_bound = max(lower[1], higher[1])
361361
lower_bound = min(lower[0], higher[0])
@@ -364,7 +364,7 @@ def _merge_columns(cl, column_tol=0):
364364
merged.append(higher)
365365
elif column_tol < 0:
366366
if higher[0] <= lower[1]:
367-
if np.isclose(higher[0], lower[1], atol=abs(column_tol)):
367+
if math.isclose(higher[0], lower[1], abs_tol=abs(column_tol)):
368368
merged.append(higher)
369369
else:
370370
upper_bound = max(lower[1], higher[1])

camelot/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""General helper utilities to parse the pdf tables."""
22

33
import atexit
4+
import math
45
import os
56
import random
67
import re
@@ -856,7 +857,7 @@ def merge_close_lines(ar, line_tol=2):
856857
ret.append(a)
857858
else:
858859
temp = ret[-1]
859-
if np.isclose(temp, a, atol=line_tol):
860+
if math.isclose(temp, a, abs_tol=line_tol):
860861
temp = (temp + a) / 2.0
861862
ret[-1] = temp
862863
else:

0 commit comments

Comments
 (0)