plydata.one_table_verbs.pull

class plydata.one_table_verbs.pull(*args, **kwargs)[source]

Pull a single column from the dataframe

Parameters
datadataframe, optional

Useful when not using the >> operator.

columnname

Column name or index id.

use_indexbool

Whether to pull column by name or by its integer index. Default is False.

Notes

Always returns a numpy array.

If plydata.options.modify_input_data is True, pull will not make a copy the original column.

Examples

>>> import pandas as pd
>>> df = pd.DataFrame({
...     'x': [1, 2, 3],
...     'y': [4, 5, 6],
...     'z': [7, 8, 9]
... })
>>> df
   x  y  z
0  1  4  7
1  2  5  8
2  3  6  9
>>> df >> pull('y')
array([4, 5, 6])
>>> df >> pull(0, True)
array([1, 2, 3])
>>> df >> pull(-1, True)
array([7, 8, 9])