def to_series(self, keep_tz=None, index=None, name=None):
from pandas import Series<EOL>if index is None:<EOL><INDENT>index = self._shallow_copy()<EOL><DEDENT>if name is None:<EOL><INDENT>name = self.name<EOL><DEDENT>if keep_tz is None and self.tz is not None:<EOL><INDENT>warnings.warn("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>", FutureWarning, stacklevel=<NUM_LIT:2>)<EOL>keep_tz = False<EOL><DEDENT>elif keep_tz is False:<EOL><INDENT>warnings.warn("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>", FutureWarning, stacklevel=<NUM_LIT:2>)<EOL><DEDENT>if keep_tz and self.tz is not None:<EOL><INDENT>values = self.copy(deep=True)<EOL><DEDENT>else:<EOL><INDENT>values = self.values.copy()<EOL><DEDENT>return Series(values, index=index, name=name)<EOL>
Create a Series with both index and values equal to the index keys
useful with map for returning an indexer based on an index

Parameters
----------
keep_tz : optional, defaults False
    Return the data keeping the timezone.

    If keep_tz is True:

      If the timezone is not set, the resulting
      Series will have a datetime64[ns] dtype.

      Otherwise the Series will have an datetime64[ns, tz] dtype; the
      tz will be preserved.

    If keep_tz is False:

      Series will have a datetime64[ns] dtype. TZ aware
      objects will have the tz removed.

    .. versionchanged:: 0.24
        The default value will change to True in a future release.
        You can set ``keep_tz=True`` to already obtain the future
        behaviour and silence the warning.

index : Index, optional
    index of resulting Series. If None, defaults to original index
name : string, optional
    name of resulting Series. If None, defaults to name of original
    index

Returns
-------
Series