anndata.AnnData.obs_vector

AnnData.obs_vector(k, *, layer=None)

Convenience function for returning a 1 dimensional ndarray of values from .X, .layers[k], or .obs.

Made for convenience, not performance. Intentionally permissive about arguments, for easy iterative use.

Parameters:
k : strstr

Key to use. Should be in .var_names or .obs.columns.

layer : str, NoneOptional[str]

What layer values should be returned from. If None, .X is used.

Return type:

ndarrayndarray

Returns:

  • A one dimensional nd array, with values for each obs in the same order
  • as .obs_names.