Teradata Python Package Function Reference - __getitem__ - Teradata Python Package - Look here for syntax, methods and examples for the functions included in the Teradata Python Package.

Teradata® Python Package Function Reference

Product
Teradata Python Package
Release Number
16.20
Published
February 2020
Language
English (United States)
Last Update
2020-07-17
lifecycle
previous
Product Category
Teradata Vantage
teradataml.dataframe.dataframe.DataFrame.__getitem__ = __getitem__(self, key)
Return a column from the DataFrame or filter the DataFrame using an expression
The following operators are supported:
  comparison: ==, !=, <, <=, >, >=
  boolean: & (and), | (or), ~ (not), ^ (xor)
 
Operands can be python literals and instances of ColumnExpressions from the DataFrame
 
EXAMPLES:
  df = DataFrame('table')
 
  # filter the DataFrame df
  df[df.c1 > df.c2]
 
  df[df.c1 >= 1]
 
  df[df.c1 == 'string']
 
  df[1 != df.c2]
 
  df[~(1 < df.c2)]
 
  df[(df.c1 > 0) & (df.c2 > df.c1)]
 
  # retrieve column c1 from df
  df['c1']
 
PARAMETERS:
  key: A column name as a string or filter expression (ColumnExpression)
 
RETURNS:
  DataFrame or ColumnExpression instance
 
RAISES:
  1. KeyError   - If key is not found
  2. ValueError - When columns of different dataframes are given in ColumnExpression.