Shortcuts

torcharrow.DataFrame.where

DataFrame.where(*conditions)

Analogous to SQL’s where (NOT Pandas where)

Filter a dataframe to only include rows satisfying a given set of conditions. df.where(p) is equivalent to writing df[p].

Examples

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

When referring to self in an expression, the special value me can be used.

>>> from torcharrow import me
>>> xf.where(me['B']>2)
  index  A      B    C
-------  ---  ---  ---
      0  a      3   12
      1  b      4   13
dtype: Struct([Field('A', string), Field('B', int64), Field('C', int64)]), count: 2, 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