Convert parsed data to Data Frame. This method will bind xml dictionary data of keys and values into named columns of Data Frame using the built-in TextParser class that build Data Frame and infers specific dtypes.
(data: list[dict[str, str | None]], **kwargs)
| 723 | |
| 724 | |
| 725 | def _data_to_frame(data: list[dict[str, str | None]], **kwargs) -> DataFrame: |
| 726 | """ |
| 727 | Convert parsed data to Data Frame. |
| 728 | |
| 729 | This method will bind xml dictionary data of keys and values |
| 730 | into named columns of Data Frame using the built-in TextParser |
| 731 | class that build Data Frame and infers specific dtypes. |
| 732 | """ |
| 733 | |
| 734 | tags = next(iter(data)) |
| 735 | nodes = [list(d.values()) for d in data] |
| 736 | |
| 737 | try: |
| 738 | with TextParser(nodes, names=tags, **kwargs) as tp: |
| 739 | return tp.read() |
| 740 | except ParserError as err: |
| 741 | raise ParserError( |
| 742 | "XML document may be too complex for import. " |
| 743 | "Try to flatten document and use distinct " |
| 744 | "element and attribute names." |
| 745 | ) from err |
| 746 | |
| 747 | |
| 748 | def _parse( |
no test coverage detected