Shortcuts

torcharrow.DataFrame.select

DataFrame.select(*args, **kwargs)

Analogous to SQL’s SELECT.

Transform a dataframe by selecting old columns and new (computed) columns.

The special symbol me can be used to refer to self.

Parameters:
  • args (positional string arguments) – Column names to keep in the projection. A column name of “*” is a shortcut to denote all columns. A column name beginning with “-” means remove this column.

  • kwargs (named value arguments) – New column name expressions to add to the projection

Examples

>>> from torcharrow import ta
>>> xf = ta.dataframe({
>>>    'A': ['a', 'b', 'a', 'b'],
>>>    'B': [1, 2, 3, 4],
>>>    'C': [10,11,12,13]})
>>> xf.select(*xf.columns,D=me['B']+me['C'])
  index  A      B    C    D
-------  ---  ---  ---  ---
      0  a      1   10   11
      1  b      2   11   13
      2  a      3   12   15
      3  b      4   13   17
dtype: Struct([Field('A', string), Field('B', int64), Field('C', int64), Field('D', int64)]), count: 4, null_count: 0

Using ‘*’ and ‘-colname’:

>>> xf.select('*','-B',D=me['B']+me['C'])
  index  A      C    D
-------  ---  ---  ---
      0  a     10   11
      1  b     11   13
      2  a     12   15
      3  b     13   17
dtype: Struct([Field('A', string), Field('C', int64), Field('D', int64)]), count: 4, null_count: 0

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources