-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
REGR: pd.to_hdf(..., dropna=True) not dropping missing rows #37564
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
Changes from 4 commits
1e8fb8c
d6e7681
d575b3a
b477931
379032e
3e22ef6
fe680a5
8b257e7
5042e63
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 |
---|---|---|
|
@@ -1253,17 +1253,32 @@ def test_append_all_nans(self, setup_path): | |
store.append("df2", df[10:], dropna=False) | ||
tm.assert_frame_equal(store["df2"], df) | ||
|
||
# Test to make sure defaults are to not drop. | ||
# Corresponding to Issue 9382 | ||
def test_store_dropna(self, setup_path): | ||
df_with_missing = DataFrame( | ||
{"col1": [0, np.nan, 2], "col2": [1, np.nan, np.nan]} | ||
{"col1": [0.0, np.nan, 2.0], "col2": [1.0, np.nan, np.nan]}, | ||
index=list("abc"), | ||
) | ||
df_without_missing = DataFrame( | ||
{"col1": [0.0, 2.0], "col2": [1.0, np.nan]}, index=list("ac") | ||
) | ||
|
||
# # Test to make sure defaults are to not drop. | ||
# # Corresponding to Issue 9382 | ||
with ensure_clean_path(setup_path) as path: | ||
df_with_missing.to_hdf(path, "df", format="table") | ||
reloaded = read_hdf(path, "df") | ||
tm.assert_frame_equal(df_with_missing, reloaded) | ||
|
||
with ensure_clean_path(setup_path) as path: | ||
df_with_missing.to_hdf(path, "df_with_missing", format="table") | ||
reloaded = read_hdf(path, "df_with_missing") | ||
df_with_missing.to_hdf(path, "df", format="table", dropna=False) | ||
reloaded = read_hdf(path, "df") | ||
tm.assert_frame_equal(df_with_missing, reloaded) | ||
|
||
with ensure_clean_path(setup_path) as path: | ||
df_with_missing.to_hdf(path, "df", format="table", dropna=True) | ||
reloaded = read_hdf(path, "df") | ||
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. hmm, do we recreate this exactly, I think so but don't really remember (is expected the same)? 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. I cherry-picked the example so it roundtrips there are some dtype issues, for example a |
||
tm.assert_frame_equal(df_without_missing, reloaded) | ||
|
||
def test_read_missing_key_close_store(self, setup_path): | ||
# GH 25766 | ||
with ensure_clean_path(setup_path) as path: | ||
|
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.
this has been quite a while, move this to 1.2
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.
Done