# Buggy code
def add_prefix(self, prefix):
    """
    Prefix labels with string `prefix`.

    For Series, the row labels are prefixed.
    For DataFrame, the column labels are prefixed.

    Parameters
    ----------
    prefix : str
       The string to add before each label.

    Returns
    -------
    Series
       New Series with updated labels.

    See Also
    --------
    Series.add_suffix: Suffix column labels with string `suffix`.
    DataFrame.add_suffix: Suffix column labels with string `suffix`.
    DataFrame.add_prefix: Prefix column labels with string `prefix`.

    Examples
    --------
    >>> s = ks.Series([1, 2, 3, 4])
    >>> s
    0    1
    1    2
    2    3
    3    4
    Name: 0, dtype: int64

    >>> s.add_prefix('item_')
    item_0    1
    item_1    2
    item_2    3
    item_3    4
    Name: 0, dtype: int64
    """
    assert isinstance(prefix, str)
    kdf = self.to_dataframe()
    internal = kdf._internal
    sdf = internal.sdf
    sdf = sdf.select(
        [
            F.concat(F.lit(prefix), sdf[index_column]).alias(index_column)
            for index_column in internal.index_columns
        ]
        + internal.data_columns
    )
    kdf._internal = internal.copy(sdf=sdf)
    return Series(kdf._internal.copy(scol=self._scol), anchor=kdf)


# 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 add_prefix(self, prefix):
    """
    Prefix labels with string `prefix`.

    For Series, the row labels are prefixed.
    For DataFrame, the column labels are prefixed.

    Parameters
    ----------
    prefix : str
       The string to add before each label.

    Returns
    -------
    Series
       New Series with updated labels.

    See Also
    --------
    Series.add_suffix: Suffix column labels with string `suffix`.
    DataFrame.add_suffix: Suffix column labels with string `suffix`.
    DataFrame.add_prefix: Prefix column labels with string `prefix`.

    Examples
    --------
    >>> s = ks.Series([1, 2, 3, 4])
    >>> s
    0    1
    1    2
    2    3
    3    4
    Name: 0, dtype: int64

    >>> s.add_prefix('item_')
    item_0    1
    item_1    2
    item_2    3
    item_3    4
    Name: 0, dtype: int64
    """
    assert isinstance(prefix, str)
    kdf = self.to_dataframe()
    internal = kdf._internal
    sdf = internal.sdf
    sdf = sdf.select(
        [
            F.concat(F.lit(prefix), scol_for(sdf, index_column)).alias(index_column)
            for index_column in internal.index_columns
        ]
        + internal.data_columns
    )
    kdf._internal = internal.copy(sdf=sdf)
    return Series(kdf._internal.copy(scol=self._scol), anchor=kdf)