Skip to content

Commit d019a2c

Browse files
committed
python3Packages.layoutparser: fix build failure
1 parent be2fade commit d019a2c

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

pkgs/development/python-modules/layoutparser/default.nix

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,11 @@ buildPythonPackage {
5454
hash = "sha256-qBzcIUmgnGy/Xn/B+7UrLrRhCvCkapL+ymqGS2sMVgA=";
5555
};
5656

57+
patches = [
58+
# https://github.com/Layout-Parser/layout-parser/pull/230
59+
./pandas-v3.patch
60+
];
61+
5762
propagatedBuildInputs = [
5863
numpy
5964
opencv-python
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/src/layoutparser/io/basic.py b/src/layoutparser/io/basic.py
2+
index 0b2df36..26dcccc 100644
3+
--- a/src/layoutparser/io/basic.py
4+
+++ b/src/layoutparser/io/basic.py
5+
@@ -127,7 +127,7 @@ def load_dataframe(df: pd.DataFrame, block_type: str = None) -> Layout:
6+
"""
7+
df = df.copy()
8+
if "points" in df.columns:
9+
- if df["points"].dtype == object:
10+
+ if df["points"].dtype == object or isinstance(df["points"].dtype, pd.StringDtype):
11+
df["points"] = df["points"].map(
12+
lambda x: ast.literal_eval(x) if not pd.isna(x) else x
13+
)

0 commit comments

Comments
 (0)