plydata.helper_verbs.select_all

class plydata.helper_verbs.select_all(*args, **kwargs)[source]

Select all columns

Parameters
datadataframe, optional

Useful when not using the >> operator.

functioncallable()

Function to rename the column(s).

argstuple

Arguments to the functions. The arguments are pass to all functions.

kwargsdict

Keyword arguments to the functions. The keyword arguments are passed to all functions.

Examples

>>> import pandas as pd
>>> from plydata import *
>>> df = pd.DataFrame({
...     'alpha': list('aaabbb'),
...     'beta': list('babruq'),
...     'theta': list('cdecde'),
...     'x': [1, 2, 3, 4, 5, 6],
...     'y': [6, 5, 4, 3, 2, 1],
...     'z': [7, 9, 11, 8, 10, 12]
... })

Select all columns and convert names to uppercase

>>> df >> select_all(str.upper)
  ALPHA BETA THETA  X  Y   Z
0     a    b     c  1  6   7
1     a    a     d  2  5   9
2     a    b     e  3  4  11
3     b    r     c  4  3   8
4     b    u     d  5  2  10
5     b    q     e  6  1  12

Group columns are selected but they are not renamed.

>>> df >> group_by('beta') >> select_all(str.upper)
groups: ['beta']
  beta ALPHA THETA  X  Y   Z
0    b     a     c  1  6   7
1    a     a     d  2  5   9
2    b     a     e  3  4  11
3    r     b     c  4  3   8
4    u     b     d  5  2  10
5    q     b     e  6  1  12