MCPcopy
hub / github.com/pandas-dev/pandas / _data_to_frame

Function _data_to_frame

pandas/io/xml.py:725–745  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

723
724
725def _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
748def _parse(

Callers 1

_parseFunction · 0.70

Calls 4

TextParserFunction · 0.90
ParserErrorClass · 0.90
valuesMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected