bpd.DataFrame.get¶
-
DataFrame.
get
(key)[source]¶ Return column or columns from data frame.
Parameters: key (str or iterable of strings) – Column label or iterable of column labels Returns: series_or_df – Series with the corresponding label or DataFrame with the corresponding column labels. Return type: Series or DataFrame Raises: KeyError
– If any column named in key not found in columns.Examples
>>> df = bpd.DataFrame().assign(letter=['a', 'b', 'c'], ... count=[9, 3, 3], ... points=[1, 2, 2]) >>> df.get('letter') 0 a 1 b 2 c Name: letter, dtype: object >>> df.get(['count', 'points']) count points 0 9 1 1 3 2 2 3 2