(self, idx)
Intel Scalable Dataframe Compiler User Guide
    ********************************************
    Pandas API: pandas.DataFrame.getitem

    Get data from a DataFrame by indexer.

    Limitations
    -----------
    Supported ``key`` can be one of the following:

    * String literal, e.g. :obj:`df['A']`
    * A slice, e.g. :obj:`df[2:5]`
    * A tuple of string, e.g. :obj:`df[('A', 'B')]`
    * An array of booleans, e.g. :obj:`df[True,False]`
    * A series of booleans, e.g. :obj:`df(series([True,False]))`

    Supported getting a column through getting attribute.

    Examples
    --------
    .. literalinclude:: ../../../examples/dataframe/getitem/df_getitem_attr.py
       :language: python
       :lines: 37-
       :caption: Getting Pandas DataFrame column through getting attribute.
       :name: ex_dataframe_getitem

    .. command-output:: python ./dataframe/getitem/df_getitem_attr.py
       :cwd: ../../../examples

    .. literalinclude:: ../../../examples/dataframe/getitem/df_getitem.py
       :language: python
       :lines: 37-
       :caption: Getting Pandas DataFrame column where key is a string.
       :name: ex_dataframe_getitem

    .. command-output:: python ./dataframe/getitem/df_getitem.py
       :cwd: ../../../examples

    .. literalinclude:: ../../../examples/dataframe/getitem/df_getitem_slice.py
       :language: python
       :lines: 34-
       :caption: Getting slice of Pandas DataFrame.
       :name: ex_dataframe_getitem

    .. command-output:: python ./dataframe/getitem/df_getitem_slice.py
       :cwd: ../../../examples

    .. literalinclude:: ../../../examples/dataframe/getitem/df_getitem_tuple.py
       :language: python
       :lines: 37-
       :caption: Getting Pandas DataFrame elements where key is a tuple of strings.
       :name: ex_dataframe_getitem

    .. command-output:: python ./dataframe/getitem/df_getitem_tuple.py
       :cwd: ../../../examples

    .. literalinclude:: ../../../examples/dataframe/getitem/df_getitem_array.py
       :language: python
       :lines: 34-
       :caption: Getting Pandas DataFrame elements where key is an array of booleans.
       :name: ex_dataframe_getitem

    .. command-output:: python ./dataframe/getitem/df_getitem_array.py
       :cwd: ../../../examples

    .. literalinclude:: ../../../examples/dataframe/getitem/df_getitem_series.py
       :language: python
       :lines: 34-
       :caption: Getting Pandas DataFrame elements where key is series of booleans.
       :name: ex_dataframe_getitem

    .. command-output:: python ./dataframe/getitem/df_getitem_series.py
       :cwd: ../../../examples

    .. seealso::
        :ref:`Series.getitem <pandas.Series.getitem>`
            Get value(s) of Series by key.
        :ref:`Series.setitem <pandas.Series.setitem>`
            Set value to Series by index
        :ref:`Series.loc <pandas.Series.loc>`
            Access a group of rows and columns by label(s) or a boolean array.
        :ref:`Series.iloc <pandas.Series.iloc>`
            Purely integer-location based indexing for selection by position.
        :ref:`Series.at <pandas.Series.at>`
            Access a single value for a row/column label pair.
        :ref:`Series.iat <pandas.Series.iat>`
            Access a single value for a row/column pair by integer position.
        :ref:`DataFrame.setitem <pandas.DataFrame.setitem>`
            Set value to DataFrame by index
        :ref:`DataFrame.loc <pandas.DataFrame.loc>`
            Access a group of rows and columns by label(s) or a boolean array.
        :ref:`DataFrame.iloc <pandas.DataFrame.iloc>`
            Purely integer-location based indexing for selection by position.
        :ref:`DataFrame.at <pandas.DataFrame.at>`
            Access a single value for a row/column label pair.
        :ref:`DataFrame.iat <pandas.DataFrame.iat>`
            Access a single value for a row/column pair by integer position.

    Intel Scalable Dataframe Compiler Developer Guide
    *************************************************

    Pandas DataFrame method :meth:`pandas.DataFrame.getitem` implementation.

    .. only:: developer

    Test: python -m sdc.runtests -k sdc.tests.test_dataframe.TestDataFrame.test_df_getitem*
Intel Scalable Dataframe Compiler User Guide
    ********************************************
    Pandas API: pandas.DataFrame.getitem
Intel Scalable Dataframe Compiler User Guide ******************************************** Pandas API : pandas . DataFrame . getitem
def sdc_pandas_dataframe_getitem(self, idx):
    """
    Intel Scalable Dataframe Compiler User Guide
    ********************************************
    Pandas API: pandas.DataFrame.getitem

    Get data from a DataFrame by indexer.

    Limitations
    -----------
    Supported ``key`` can be one of the following:

    * String literal, e.g. :obj:`df['A']`
    * A slice, e.g. :obj:`df[2:5]`
    * A tuple of string, e.g. :obj:`df[('A', 'B')]`
    * An array of booleans, e.g. :obj:`df[True,False]`
    * A series of booleans, e.g. :obj:`df(series([True,False]))`

    Supported getting a column through getting attribute.

    Examples
    --------
    .. literalinclude:: ../../../examples/dataframe/getitem/df_getitem_attr.py
       :language: python
       :lines: 37-
       :caption: Getting Pandas DataFrame column through getting attribute.
       :name: ex_dataframe_getitem

    .. command-output:: python ./dataframe/getitem/df_getitem_attr.py
       :cwd: ../../../examples

    .. literalinclude:: ../../../examples/dataframe/getitem/df_getitem.py
       :language: python
       :lines: 37-
       :caption: Getting Pandas DataFrame column where key is a string.
       :name: ex_dataframe_getitem

    .. command-output:: python ./dataframe/getitem/df_getitem.py
       :cwd: ../../../examples

    .. literalinclude:: ../../../examples/dataframe/getitem/df_getitem_slice.py
       :language: python
       :lines: 34-
       :caption: Getting slice of Pandas DataFrame.
       :name: ex_dataframe_getitem

    .. command-output:: python ./dataframe/getitem/df_getitem_slice.py
       :cwd: ../../../examples

    .. literalinclude:: ../../../examples/dataframe/getitem/df_getitem_tuple.py
       :language: python
       :lines: 37-
       :caption: Getting Pandas DataFrame elements where key is a tuple of strings.
       :name: ex_dataframe_getitem

    .. command-output:: python ./dataframe/getitem/df_getitem_tuple.py
       :cwd: ../../../examples

    .. literalinclude:: ../../../examples/dataframe/getitem/df_getitem_array.py
       :language: python
       :lines: 34-
       :caption: Getting Pandas DataFrame elements where key is an array of booleans.
       :name: ex_dataframe_getitem

    .. command-output:: python ./dataframe/getitem/df_getitem_array.py
       :cwd: ../../../examples

    .. literalinclude:: ../../../examples/dataframe/getitem/df_getitem_series.py
       :language: python
       :lines: 34-
       :caption: Getting Pandas DataFrame elements where key is series of booleans.
       :name: ex_dataframe_getitem

    .. command-output:: python ./dataframe/getitem/df_getitem_series.py
       :cwd: ../../../examples

    .. seealso::
        :ref:`Series.getitem <pandas.Series.getitem>`
            Get value(s) of Series by key.
        :ref:`Series.setitem <pandas.Series.setitem>`
            Set value to Series by index
        :ref:`Series.loc <pandas.Series.loc>`
            Access a group of rows and columns by label(s) or a boolean array.
        :ref:`Series.iloc <pandas.Series.iloc>`
            Purely integer-location based indexing for selection by position.
        :ref:`Series.at <pandas.Series.at>`
            Access a single value for a row/column label pair.
        :ref:`Series.iat <pandas.Series.iat>`
            Access a single value for a row/column pair by integer position.
        :ref:`DataFrame.setitem <pandas.DataFrame.setitem>`
            Set value to DataFrame by index
        :ref:`DataFrame.loc <pandas.DataFrame.loc>`
            Access a group of rows and columns by label(s) or a boolean array.
        :ref:`DataFrame.iloc <pandas.DataFrame.iloc>`
            Purely integer-location based indexing for selection by position.
        :ref:`DataFrame.at <pandas.DataFrame.at>`
            Access a single value for a row/column label pair.
        :ref:`DataFrame.iat <pandas.DataFrame.iat>`
            Access a single value for a row/column pair by integer position.

    Intel Scalable Dataframe Compiler Developer Guide
    *************************************************

    Pandas DataFrame method :meth:`pandas.DataFrame.getitem` implementation.

    .. only:: developer

    Test: python -m sdc.runtests -k sdc.tests.test_dataframe.TestDataFrame.test_df_getitem*
    """
    ty_checker = TypeChecker('Operator getitem().')

    if not isinstance(self, DataFrameType):
        return None

    if isinstance(idx, types.StringLiteral):
        col_loc = self.column_loc.get(idx.literal_value)
        if col_loc is None:
            key_error = True
        else:
            type_id, col_id = col_loc.type_id, col_loc.col_id
            key_error = False

        def _df_getitem_str_literal_idx_impl(self, idx):
            if key_error == False:  # noqa
                data = self._data[type_id][col_id]
                return pandas.Series(data, index=self._index, name=idx)
            else:
                raise KeyError('Column is not in the DataFrame')

        return _df_getitem_str_literal_idx_impl

    if isinstance(idx, types.UnicodeType):

        def _df_getitem_unicode_idx_impl(self, idx):
            # http://numba.pydata.org/numba-doc/dev/developer/literal.html#specifying-for-literal-typing
            # literally raises special exception to call getitem with literal idx value got from unicode
            return literally(idx)

        return _df_getitem_unicode_idx_impl

    if isinstance(idx, types.Tuple):
        if all([isinstance(item, types.StringLiteral) for item in idx]):
            return gen_df_getitem_tuple_idx_impl(self, idx)

    if isinstance(idx, types.SliceType):
        return gen_df_getitem_slice_idx_impl(self, idx)

    if isinstance(idx, SeriesType) and isinstance(idx.dtype, types.Boolean):
        if not check_types_comparable(self.index, idx.index):
            ty_checker.raise_exc(idx.index.dtype, self.index.dtype, 'idx.index.dtype')

        return gen_df_getitem_bool_series_idx_impl(self, idx)

    if isinstance(idx, types.Array) and isinstance(idx.dtype, types.Boolean):
        return gen_df_getitem_bool_array_idx_impl(self, idx)

    ty_checker = TypeChecker('Operator getitem().')
    expected_types = 'str, tuple(str), slice, series(bool), array(bool)'
    ty_checker.raise_exc(idx, expected_types, 'idx')
def sdc_pandas_dataframe_getitem ( self , idx ) : ty_checker = TypeChecker ( 'Operator getitem().' ) if not isinstance ( self , DataFrameType ) : return None if isinstance ( idx , types . StringLiteral ) : col_loc = self . column_loc . get ( idx . literal_value ) if col_loc is None : key_error = True else : type_id , col_id = col_loc . type_id , col_loc . col_id key_error = False def _df_getitem_str_literal_idx_impl ( self , idx ) : if key_error == False : # noqa data = self . _data [ type_id ] [ col_id ] return pandas . Series ( data , index = self . _index , name = idx ) else : raise KeyError ( 'Column is not in the DataFrame' ) return _df_getitem_str_literal_idx_impl if isinstance ( idx , types . UnicodeType ) : def _df_getitem_unicode_idx_impl ( self , idx ) : # http://numba.pydata.org/numba-doc/dev/developer/literal.html#specifying-for-literal-typing # literally raises special exception to call getitem with literal idx value got from unicode return literally ( idx ) return _df_getitem_unicode_idx_impl if isinstance ( idx , types . Tuple ) : if all ( [ isinstance ( item , types . StringLiteral ) for item in idx ] ) : return gen_df_getitem_tuple_idx_impl ( self , idx ) if isinstance ( idx , types . SliceType ) : return gen_df_getitem_slice_idx_impl ( self , idx ) if isinstance ( idx , SeriesType ) and isinstance ( idx . dtype , types . Boolean ) : if not check_types_comparable ( self . index , idx . index ) : ty_checker . raise_exc ( idx . index . dtype , self . index . dtype , 'idx.index.dtype' ) return gen_df_getitem_bool_series_idx_impl ( self , idx ) if isinstance ( idx , types . Array ) and isinstance ( idx . dtype , types . Boolean ) : return gen_df_getitem_bool_array_idx_impl ( self , idx ) ty_checker = TypeChecker ( 'Operator getitem().' ) expected_types = 'str, tuple(str), slice, series(bool), array(bool)' ty_checker . raise_exc ( idx , expected_types , 'idx' )