domain_to_dataframe#
- domain_to_dataframe(domain)#
Generate a pandas.dataframe from a domain object. All object properties will be saved as columns in the dataframe file including labels and collections associated with the object. If the domain contains shape objects, the dataframe will include the vertices of the shapes instead of the shape centroids. There will be an additional column ‘hole_id’ to identify vertices that belong to internal holes of shapes.
- Parameters:
- domainmuspan.domain
The domain object to be exported as pandas.dataframe.
- Returns:
- pandas.DataFrame
The dataframe generated from the domain.
- Raises:
- ValueError
If domain is not of type
muspan.domain.
Examples
import muspan as ms # load an example domain example_domain = ms.datasets.load_example_domain('Xenium-Healthy-Colon') # convert the domain to a dataframe domain_df = ms.io.helpers.domain_to_dataframe(example_domain) # print the first few rows of the dataframe print(domain_df.head())