def to_period(self, freq=None, copy=True):
new_values = self._values<EOL>if copy:<EOL><INDENT>new_values = new_values.copy()<EOL><DEDENT>new_index = self.index.to_period(freq=freq)<EOL>return self._constructor(new_values,<EOL>index=new_index).__finalize__(self)<EOL>
Convert Series from DatetimeIndex to PeriodIndex with desired
frequency (inferred from index if not passed).

Parameters
----------
freq : str, default None
    Frequency associated with the PeriodIndex.
copy : bool, default True
    Whether or not to return a copy.

Returns
-------
Series
    Series with index converted to PeriodIndex.