The metadata for the data frame, as a dictionary with string keys. The contents of `metadata` may be anything, they are meant for a library to store information that it needs to, e.g., roundtrip losslessly or for two implementations to share data that is not (yet) pa
(self)
| 82 | |
| 83 | @property |
| 84 | def metadata(self) -> dict[str, Any]: |
| 85 | """ |
| 86 | The metadata for the data frame, as a dictionary with string keys. The |
| 87 | contents of `metadata` may be anything, they are meant for a library |
| 88 | to store information that it needs to, e.g., roundtrip losslessly or |
| 89 | for two implementations to share data that is not (yet) part of the |
| 90 | interchange protocol specification. For avoiding collisions with other |
| 91 | entries, please add name the keys with the name of the library |
| 92 | followed by a period and the desired name, e.g, ``pandas.indexcol``. |
| 93 | """ |
| 94 | # The metadata for the data frame, as a dictionary with string keys. |
| 95 | # Add schema metadata here (pandas metadata or custom metadata) |
| 96 | if self._df.schema.metadata: |
| 97 | schema_metadata = {"pyarrow." + k.decode('utf8'): v.decode('utf8') |
| 98 | for k, v in self._df.schema.metadata.items()} |
| 99 | return schema_metadata |
| 100 | else: |
| 101 | return {} |
| 102 | |
| 103 | def num_columns(self) -> int: |
| 104 | """ |