-
Notifications
You must be signed in to change notification settings - Fork 364
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
Coalesce all data_type attributes of frame into one #185
Changes from 3 commits
2cef000
bdb334b
11b1ae8
6dcb1a3
9bd4c23
0a9c245
4c052e7
4010784
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,19 +45,28 @@ def test_rename_inplace(global_var): | |
|
||
assert df.data_type_lookup["Name"] == new_df.data_type_lookup["Car Name"] | ||
|
||
assert df.data_type != new_df.data_type | ||
data_type = df.compute_data_type_from_lookup() | ||
new_data_type = new_df.compute_data_type_from_lookup() | ||
|
||
assert df.data_type["nominal"][0] == "Name" | ||
assert new_df.data_type["nominal"][0] == "Car Name" | ||
assert data_type != new_data_type | ||
|
||
assert df.data_model_lookup != new_df.data_model_lookup | ||
assert data_type["nominal"][0] == "Name" | ||
assert new_data_type["nominal"][0] == "Car Name" | ||
|
||
assert df.data_model_lookup["Name"] == new_df.data_model_lookup["Car Name"] | ||
data_model_lookup = df.compute_data_model_lookup() | ||
new_data_model_lookup = new_df.compute_data_model_lookup() | ||
|
||
assert df.data_model != new_df.data_model | ||
assert data_model_lookup != new_data_model_lookup | ||
|
||
assert df.data_model["dimension"][0] == "Name" | ||
assert new_df.data_model["dimension"][0] == "Car Name" | ||
assert data_model_lookup["Name"] == new_data_model_lookup["Car Name"] | ||
|
||
data_model = df.compute_data_model() | ||
new_data_model = new_df.compute_data_model() | ||
|
||
assert data_model != new_data_model | ||
|
||
assert data_model["dimension"][0] == "Name" | ||
assert new_data_model["dimension"][0] == "Car Name" | ||
|
||
assert list(df.unique_values.values()) == list(new_df.unique_values.values()) | ||
assert list(df.cardinality.values()) == list(new_df.cardinality.values()) | ||
|
@@ -75,19 +84,28 @@ def test_rename(global_var): | |
|
||
assert df.data_type_lookup["Name"] == new_df.data_type_lookup["Car Name"] | ||
|
||
assert df.data_type != new_df.data_type | ||
data_type = df.compute_data_type_from_lookup() | ||
new_data_type = new_df.compute_data_type_from_lookup() | ||
|
||
assert data_type != new_data_type | ||
|
||
assert data_type["nominal"][0] == "Name" | ||
assert new_data_type["nominal"][0] == "Car Name" | ||
|
||
data_model_lookup = df.compute_data_model_lookup() | ||
new_data_model_lookup = new_df.compute_data_model_lookup() | ||
|
||
assert df.data_type["nominal"][0] == "Name" | ||
assert new_df.data_type["nominal"][0] == "Car Name" | ||
assert data_model_lookup != new_data_model_lookup | ||
|
||
assert df.data_model_lookup != new_df.data_model_lookup | ||
assert data_model_lookup["Name"] == new_data_model_lookup["Car Name"] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here maybe we could just compute the equality between the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, do you want me to get rid of lines 98-100? |
||
|
||
assert df.data_model_lookup["Name"] == new_df.data_model_lookup["Car Name"] | ||
data_model = df.compute_data_model() | ||
new_data_model = new_df.compute_data_model() | ||
|
||
assert df.data_model != new_df.data_model | ||
assert data_model != new_data_model | ||
|
||
assert df.data_model["dimension"][0] == "Name" | ||
assert new_df.data_model["dimension"][0] == "Car Name" | ||
assert data_model["dimension"][0] == "Name" | ||
assert new_data_model["dimension"][0] == "Car Name" | ||
|
||
assert list(df.unique_values.values()) == list(new_df.unique_values.values()) | ||
assert list(df.cardinality.values()) == list(new_df.cardinality.values()) | ||
|
@@ -503,9 +521,6 @@ def test_df_to_series(global_var): | |
assert df["Weight"]._metadata == [ | ||
"_intent", | ||
"data_type_lookup", | ||
"data_type", | ||
"data_model_lookup", | ||
"data_model", | ||
"unique_values", | ||
"cardinality", | ||
"_rec_info", | ||
|
@@ -534,9 +549,6 @@ def test_value_counts(global_var): | |
assert df["Weight"]._metadata == [ | ||
"_intent", | ||
"data_type_lookup", | ||
"data_type", | ||
"data_model_lookup", | ||
"data_model", | ||
"unique_values", | ||
"cardinality", | ||
"_rec_info", | ||
|
@@ -564,9 +576,6 @@ def test_str_replace(global_var): | |
assert df["Brand"]._metadata == [ | ||
"_intent", | ||
"data_type_lookup", | ||
"data_type", | ||
"data_model_lookup", | ||
"data_model", | ||
"unique_values", | ||
"cardinality", | ||
"_rec_info", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,9 @@ def test_check_int_id(): | |
"https://github.com/lux-org/lux-datasets/blob/master/data/instacart_sample.csv?raw=true" | ||
) | ||
df._repr_html_() | ||
assert len(df.data_type["id"]) == 3 | ||
data_type = df.compute_data_type_from_lookup() | ||
assert len(data_type["id"]) == 3 | ||
# assert len(df.data_type["id"]) == 3 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove comment? |
||
assert ( | ||
"<code>order_id</code>, <code>product_id</code>, <code>user_id</code> is not visualized since it resembles an ID field." | ||
in df._message.to_html() | ||
|
@@ -176,7 +178,8 @@ def test_float_categorical(): | |
] | ||
df = pd.DataFrame(values) | ||
df.maintain_metadata() | ||
assert df.data_type["nominal"] == [ | ||
data_type = df.compute_data_type_from_lookup() | ||
assert data_type["nominal"] == [ | ||
"A", | ||
"B", | ||
"C", | ||
|
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 is this inside the
frame.py
instead of theExecutor.py
(which is still shared acrossSQLExecutor
andPandasExecutor
)? I think that earlier this semester @thyneb19 worked on moving data type related stuff outside offrame.py
so maybe we should keep it that way?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, I'll move it over