-
Notifications
You must be signed in to change notification settings - Fork 2
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
Datafarm #6
base: main
Are you sure you want to change the base?
Conversation
watobs/datafarm.py
Outdated
zipped = zip( | ||
o["schema"]["fields"], pj.build_table_schema(df, index=False)["fields"] | ||
) # ignoring index from the newly created frame | ||
for m, l in zipped: |
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.
Please use slightly longer names (or at least avoid l as variable name) in for m, l in zipped
watobs/datafarm.py
Outdated
response.raise_for_status() | ||
self.access_token = response.headers["Access-Token"] | ||
self.headers = {"Access-Token": self.access_token} | ||
return self.access_token |
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.
Why do you return the access_token? Is that meaningful?
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 you are right, it is better to leave it out.
|
||
return to_pandas_df(json.dumps(data)) | ||
|
||
def get_data( |
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.
Please
- rename time_series to time_series_id
- rename limit_row_count to limit
- rename range_start to start
- rename range_end to end
- start and end should be flexible in terms of type - make a private function _parse_datetime(dt) that outputs the desired str format. Use pd.to_datetime and dt.isoformat() + 'Z'
- use reasonable defaults for start = datetime.min and end = datetime.now()
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.
Great work. A couple of comments though:
- Tests are missing. I created a test file that you can populate with tests. Please add relevant tests
- I guess you will delete the "if name == "main"" part when you're done?
- See comments on get_data arguments
Draft