-
Notifications
You must be signed in to change notification settings - Fork 1
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
Assign nullable dtypes to dataframe columns #7
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
e0a33bf
allow nullable columns for pd parquet dfs
hamima-halim 9ed0b4c
blah
hamima-halim c3551e2
Merge branch 'main' of github.com:transitmatters/mbta-performance int…
hamima-halim 67b9615
idk
hamima-halim 16f7570
import pd in test
hamima-halim File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+997 KB
...rmance/chalicelib/lamp/tests/sample_data/2024-02-07-subway-on-time-performance-v1.parquet
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
from datetime import date | ||
import unittest | ||
from unittest import mock | ||
|
||
import pandas as pd | ||
|
||
from .. import ingest | ||
|
||
|
||
DATA_PATH = "mbta-performance/chalicelib/lamp/tests/sample_data/2024-02-07-subway-on-time-performance-v1.parquet" | ||
|
||
|
||
class TestIngest(unittest.TestCase): | ||
def setUp(self): | ||
with open(DATA_PATH, "rb") as f: | ||
self.data = f.read() | ||
|
||
def _mock_s3_upload(self): | ||
# mock upload of s3.upload_df_as_csv() to a fake bucket | ||
pass | ||
|
||
def test__process_arrival_departure_times(self): | ||
pass | ||
|
||
def test_fetch_pq_file_from_remote(self): | ||
mock_response = mock.Mock(status_code=200, content=self.data) | ||
with mock.patch("requests.get", return_value=mock_response): | ||
inital_df = ingest.fetch_pq_file_from_remote(date(2024, 2, 7)) | ||
self.assertListEqual( | ||
list(inital_df.dtypes), | ||
[ | ||
pd.Int64Dtype(), # service_date | ||
"string[python]", # route_id | ||
"string[python]", # trip_id | ||
"string[python]", # stop_id | ||
pd.BooleanDtype(), # direction_id | ||
pd.Int16Dtype(), # stop_sequence | ||
"string[python]", # vehicle_id | ||
"string[python]", # vehicle_label | ||
pd.Int64Dtype(), # move_timestamp | ||
pd.Int64Dtype(), # stop_timestamp | ||
], | ||
) | ||
|
||
def test_ingest_pq_file(self): | ||
pass | ||
|
||
def test_upload_to_s3(self): | ||
pass | ||
|
||
def test_ingest_today_lamp_data(self): | ||
pass |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Thanks so much for documenting everything 👏