#NEWLINE# def to_period( self , freq = None , copy = True ) : #NEWLINE# #INDENT# '\n        Convert Series from DatetimeIndex to PeriodIndex with desired\n        frequency (inferred from index if not passed)\n\n        Parameters\n        ----------\n        freq : string, default\n\n        Returns\n        -------\n        ts : Series with PeriodIndex\n        ' #NEWLINE# new_values = self . _values #NEWLINE# if copy : #NEWLINE# #INDENT# new_values = new_values . copy ( ) #NEWLINE# #UNINDENT# new_index = self . index . to_period ( freq = freq ) #NEWLINE# return self . _constructor ( new_values , index = new_index ) . __finalize__ ( self )