MCPcopy Index your code
hub / github.com/Layout-Parser/layout-parser / load_csv

Function load_csv

src/layoutparser/io/basic.py:92–110  ·  view source on GitHub ↗

Load the Layout object from the given CSV file. Args: filename (str): The name of the CSV file. A row of the table represents an individual layout element. block_type (str): If there's no block_type column in the CSV file, you mus

(filename: str, block_type: str = None)

Source from the content-addressed store, hash-verified

90
91
92def load_csv(filename: str, block_type: str = None) -> Layout:
93 """Load the Layout object from the given CSV file.
94
95 Args:
96 filename (str):
97 The name of the CSV file. A row of the table represents
98 an individual layout element.
99
100 block_type (str):
101 If there's no block_type column in the CSV file,
102 you must pass in a block_type variable such that layout parser
103 can appropriately detect the type of the layout elements.
104
105 Returns:
106 Layout:
107 The parsed Layout object from the CSV file.
108 """
109
110 return load_dataframe(pd.read_csv(filename), block_type=block_type)
111
112
113def load_dataframe(df: pd.DataFrame, block_type: str = None) -> Layout:

Callers 1

test_csvFunction · 0.90

Calls 1

load_dataframeFunction · 0.85

Tested by 1

test_csvFunction · 0.72