pyform.util.dataframe.
set_col_as_datetime_index
Sets a column in the DataFrame as its datetime index, and name the index “datetime”
df – dataframe to set datetime index
col – column to set as the datetime index for the DataFrame
ValueError – when column cannot be converted to datetime index
a pandas dataframe with datetime index
pd.DataFrame
pyform.util.freq.
calc_samples_per_year
Computes number of data points per year, given time range
num_samples – total number of samples
start – start date of samples
end – end date of samples
average number of samples per year
float
calc_timedelta_in_years
To use this function, start and end dates should come from a series of daily frequency.
start – start date
end – end date
time delta in number of years
infer_freq
Infer the frequency of the time series
series – a pandas DataFrame with datetime index
use – number of data points to use from the head and tail of the time series index in order to determin frequency. This should be at least 10. Defaults to 50.
ValueError – when multiple frequencies are detected
ValueError – when no frequency can be detected
frequency of the time series
str
is_lower_freq
Tests freq1 has a lower or equal frequency than freq2. Lower frequencies cannot be converted to higher frequencies due to lower resolution.
freq1 – frequency 1
freq2 – frequency 2
frequency 1 is lower than or euqal to frequency 2
bool