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)
| 90 | |
| 91 | |
| 92 | def 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 | |
| 113 | def load_dataframe(df: pd.DataFrame, block_type: str = None) -> Layout: |