-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Signal.update() to include all fields #2
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@complementizer thank you for this
i will take a pass now and directly push to this PR if that's ok?
then we can sync next week
@@ -286,16 +292,17 @@ def anomaly_signal( | |||
:param: history_length: history length | |||
:param: history_interval: history interval (months, days, hours, ...) | |||
""" | |||
if not overwrite_existing and 'anomalies' in self.timeseries_df.columns: | |||
if not self.timeseries_df["anomalies"].isnull().values.any(): | |||
return self |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should check dependent on the dates specified by the user, not globally
@@ -399,6 +414,26 @@ def from_dict(data): | |||
args['feeds_df'] = args.pop('stories_df') | |||
return signal_type.from_dict(args) | |||
|
|||
def copy(self, included_columns=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think we may be able to use self.from_dict
for this, need to double check
@@ -510,6 +544,26 @@ def from_dict(data): | |||
ts_column=data['ts_column'], | |||
) | |||
|
|||
def copy(self, included_columns=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try to put this on base class
@@ -643,7 +728,7 @@ def update(self, start=None, end=None, freq='D', ts_endpoint=None): | |||
any new data while retaining the existing information as well | |||
:param start: datetime | |||
:param end: datetime | |||
""" | |||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try to put this on base class
@@ -677,22 +764,53 @@ def update(self, start=None, end=None, freq='D', ts_endpoint=None): | |||
# we're only going to be clever about extending to the right, | |||
# if user wants historical data (before the data we already have), | |||
# everything's getting retrieved | |||
if self.timeseries_df is not None and start in self.timeseries_df.index: | |||
if self.timeseries_df is not None and start in self.timeseries_df.index: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note extra whitespace
period = self.pd_freq_to_aylien_period(freq) | ||
aylien_ts_df = self.query_news_signals(start, end, period, ts_endpoint) | ||
if self.timeseries_df is None: | ||
self.timeseries_df = aylien_ts_df | ||
else: | ||
else: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note extra whitespace
@chrishokamp yep sure |
Signal.update() includes anomalies, summaries and wikipedia-pageviews if present.
I changed
signal.anomaly_signal()
a bit to make it work and added asignal.copy()
to all signal classes.