# Buggy code
def shift(self, periods=1, fill_value=None):
    """
    Shift DataFrame by desired number of periods.

    .. note:: the current implementation of shift uses Spark's Window without
        specifying partition specification. This leads to move all data into
        single partition in single machine and could cause serious
        performance degradation. Avoid this method against very large dataset.

    Parameters
    ----------
    periods : int
        Number of periods to shift. Can be positive or negative.
    fill_value : object, optional
        The scalar value to use for newly introduced missing values.
        The default depends on the dtype of self. For numeric data, np.nan is used.

    Returns
    -------
    Copy of input DataFrame, shifted.

    Examples
    --------
    >>> df = ks.DataFrame({'Col1': [10, 20, 15, 30, 45],
    ...                    'Col2': [13, 23, 18, 33, 48],
    ...                    'Col3': [17, 27, 22, 37, 52]},
    ...                   columns=['Col1', 'Col2', 'Col3'])

    >>> df.shift(periods=3)
       Col1  Col2  Col3
    0   NaN   NaN   NaN
    1   NaN   NaN   NaN
    2   NaN   NaN   NaN
    3  10.0  13.0  17.0
    4  20.0  23.0  27.0

    >>> df.shift(periods=3, fill_value=0)
       Col1  Col2  Col3
    0     0     0     0
    1     0     0     0
    2     0     0     0
    3    10    13    17
    4    20    23    27

    """
    applied = []
    for column in self._internal.data_columns:
        applied.append(self[column].shift(periods, fill_value))

    sdf = self._sdf.select(self._internal.index_columns + [c._scol for c in applied])
    internal = self._internal.copy(sdf=sdf, data_columns=[c.name for c in applied])
    return DataFrame(internal)


# Traceback (KeyError)
df = ks.read_parquet("/mnt/ivan/sample.parquet")
df['a.b']

# KeyError: 'a.b'
# ---------------------------------------------------------------------------
# KeyError                                  Traceback (most recent call last)
# <command-3188040896828876> in <module>()
#       1 df = ks.read_parquet("/mnt/ivan/sample.parquet")
# ----> 2 df['a.b']
#
# /databricks/python/lib/python3.5/site-packages/databricks/koalas/frame.py in __getitem__(self, key)
#     448
#     449     def __getitem__(self, key):
# --> 450         return self._pd_getitem(key)
#     451
#     452     def __setitem__(self, key, value):
#
# /databricks/python/lib/python3.5/site-packages/databricks/koalas/frame.py in _pd_getitem(self, key)
#     427                 return Series(self._sdf.__getitem__(key), self, self._metadata.index_info)
#     428             except AnalysisException:
# --> 429                 raise KeyError(key)
#     430         if np.isscalar(key) or isinstance(key, (tuple, string_types)):
#     431             raise NotImplementedError(key)
#
# KeyError: 'a.b'

# Fixed code
def shift(self, periods=1, fill_value=None):
    """
    Shift DataFrame by desired number of periods.

    .. note:: the current implementation of shift uses Spark's Window without
        specifying partition specification. This leads to move all data into
        single partition in single machine and could cause serious
        performance degradation. Avoid this method against very large dataset.

    Parameters
    ----------
    periods : int
        Number of periods to shift. Can be positive or negative.
    fill_value : object, optional
        The scalar value to use for newly introduced missing values.
        The default depends on the dtype of self. For numeric data, np.nan is used.

    Returns
    -------
    Copy of input DataFrame, shifted.

    Examples
    --------
    >>> df = ks.DataFrame({'Col1': [10, 20, 15, 30, 45],
    ...                    'Col2': [13, 23, 18, 33, 48],
    ...                    'Col3': [17, 27, 22, 37, 52]},
    ...                   columns=['Col1', 'Col2', 'Col3'])

    >>> df.shift(periods=3)
       Col1  Col2  Col3
    0   NaN   NaN   NaN
    1   NaN   NaN   NaN
    2   NaN   NaN   NaN
    3  10.0  13.0  17.0
    4  20.0  23.0  27.0

    >>> df.shift(periods=3, fill_value=0)
       Col1  Col2  Col3
    0     0     0     0
    1     0     0     0
    2     0     0     0
    3    10    13    17
    4    20    23    27

    """
    applied = []
    for column in self._internal.data_columns:
        applied.append(self[column].shift(periods, fill_value))

    sdf = self._sdf.select(self._internal.index_scols + [c._scol for c in applied])
    internal = self._internal.copy(sdf=sdf, data_columns=[c.name for c in applied])
    return DataFrame(internal)