def asfreq(obj, freq, method=None, how=None, normalize=False, fill_value=None):
if isinstance(obj.index, PeriodIndex):<EOL><INDENT>if method is not None:<EOL><INDENT>raise NotImplementedError("<STR_LIT>")<EOL><DEDENT>if how is None:<EOL><INDENT>how = '<STR_LIT:E>'<EOL><DEDENT>new_obj = obj.copy()<EOL>new_obj.index = obj.index.asfreq(freq, how=how)<EOL><DEDENT>elif len(obj.index) == <NUM_LIT:0>:<EOL><INDENT>new_obj = obj.copy()<EOL>new_obj.index = obj.index._shallow_copy(freq=to_offset(freq))<EOL><DEDENT>else:<EOL><INDENT>dti = date_range(obj.index[<NUM_LIT:0>], obj.index[-<NUM_LIT:1>], freq=freq)<EOL>dti.name = obj.index.name<EOL>new_obj = obj.reindex(dti, method=method, fill_value=fill_value)<EOL>if normalize:<EOL><INDENT>new_obj.index = new_obj.index.normalize()<EOL><DEDENT><DEDENT>return new_obj<EOL>
Utility frequency conversion method for Series/DataFrame.