How to use 'dimension of pandas dataframe' in Python

Every line of 'dimension of pandas dataframe' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
947def dframe(self, dimensions=None, multi_index=False):
948 """Convert dimension values to DataFrame.
950 Returns a pandas dataframe of columns along each dimension,
951 either completely flat or indexed by key dimensions.
953 Args:
954 dimensions: Dimensions to return as columns
955 multi_index: Convert key dimensions to (multi-)index
957 Returns:
958 DataFrame of columns corresponding to each dimension
959 """
960 if dimensions is None:
961 dimensions = [ for d in self.dimensions()]
962 else:
963 dimensions = [self.get_dimension(d, strict=True).name for d in dimensions]
964 df = self.interface.dframe(self, dimensions)
965 if multi_index:
966 df = df.set_index([d for d in dimensions if d in self.kdims])
967 return df

Related snippets