BPt.Dataset.get_subjects#

Dataset.get_subjects(subjects, return_as='index', only_level=None)[source]#

Method to get a set of subjects, from a set of already loaded ones, or from a saved location.

Parameters
subjectsSubjects

This argument can be any of the BPt accepted subject style inputs. E.g., None, ‘nan’ for subjects with any nan data, or ‘not not’ for subjects without any, the str location of a file formatted with one subject per line, or directly as an array-like of subjects, to list a few options.

See Subjects for all options, and a more detailed description of the already mentioned options.

return_as[‘set’, ‘index’, ‘flat index’], optional
  • ‘set’

    Return as set of subjects. Note, that as a of newer version of pandas indexing with a set of subjects will be depreciated.

  • ‘index’

    Return as sorted pandas.Index, or if underlying multi-index as a pandas.MultiIndex. (default)

  • ‘flat index’

    Return as sorted pandas.Index, note that if not an underlying multi-index this will return the same result as ‘index’, when MultiIndex, will return the index as a flat Index of tuples.

default = 'index'
only_levelint or None, optional

This parameter is only relevant when the underlying index is a MultiIndex.

Note: this param is not relevant when using special tuple style input for subjects.

default = None
Returns
subjectsset, pandas.Index or pandas.MultiIndex

Based on value of return_as, returns as a set of subjects, sorted pandas.Index, sorted pandas.MultiIndex or flattened and sorted pandas.Index representing a pandas.MultiIndex.