Browse Source

type hints and docs

find_closest_changes
Gourav Kumar 2 years ago
parent
commit
ef68ae0293
  1. 8
      pyfacts/core.py

8
pyfacts/core.py

@ -101,7 +101,7 @@ class _IndexSlicer:
def __init__(self, parent_obj: object):
self.parent = parent_obj
def __getitem__(self, n):
def __getitem__(self, n) -> Mapping:
if isinstance(n, int):
keys: list = [self.parent.dates[n]]
else:
@ -378,7 +378,7 @@ class TimeSeriesCore:
validate_frequency: boolean, default True
Whether the provided frequency should be validated against the data.
When set to True, if the expected number of data points are not withint the expected limits,
When set to True, if the expected number of data points are not within the expected limits,
it will raise an Exception and object creation will fail.
Validation is performed only if data contains at least 12 data points, as a fewer number of
data points are not sufficient to determine the frequency correctly.
@ -401,7 +401,7 @@ class TimeSeriesCore:
if validate_frequency and len(ts_data) >= 12:
if validation["frequency_match"] is not None and not validation["frequency_match"]:
raise ValueError(
f"Data appears to be of frquency {validation['expected_frequency']!r}, "
f"Data appears to be of frequency {validation['expected_frequency']!r}, "
f"but {frequency!r} was provided. Pass the correct frequency."
"\nPass validate_frequency=False to disable this validation."
)
@ -685,7 +685,7 @@ class TimeSeriesCore:
return key in self.data
def _arithmatic_validator(self, other):
"""Validates input data before performing math operatios"""
"""Validates input data before performing math operations"""
if not isinstance(other, (Number, Series, TimeSeriesCore)):
raise TypeError(

Loading…
Cancel
Save