Skip to content
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

Tweak date/datetime inference, remove dependency on non-core Numpy/Pandas API #802

Merged
merged 10 commits into from
Nov 10, 2019
Prev Previous commit
Next Next commit
remove pd.fillna
  • Loading branch information
sc1f committed Nov 7, 2019
commit b00472ce643f20a00e6accd6495059b7b8989351
3 changes: 0 additions & 3 deletions python/perspective/perspective/table/_accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,6 @@ def _type_to_format(data_or_schema):
# flatten column/index multiindex
df, _ = deconstruct_pandas(data_or_schema)

# try to squash object dtype as much as possible
df.fillna(value=numpy.nan, inplace=True)

return True, 1, {c: df[c].values for c in df.columns}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def test_table_dataframe_does_not_mutate(self):
assert tbl.size() == 4
assert tbl.schema() == {
"index": int,
"a": float,
"a": int,
"b": float
}

Expand Down Expand Up @@ -282,7 +282,7 @@ def test_table_pandas_transitive(self):
"a": [1, 2, 3, 4],
"b": [1.5, 2.5, 3.5, 4.5],
"c": [np.nan, np.nan, "abc", np.nan],
"d": [np.nan, True, np.nan, False],
"d": [None, True, None, False],
"e": [float("nan"), datetime(2019, 7, 11, 12, 30), float("nan"), datetime(2019, 7, 11, 12, 30)]
})

Expand All @@ -306,7 +306,7 @@ def test_table_pandas_object_to_int(self):
table = Table(df)
assert table.schema() == {
"index": int,
"a": float
"a": int
}
assert table.view().to_dict()["a"] == [1, 2, None, 2, None, 3, 4]

Expand All @@ -317,7 +317,7 @@ def test_table_pandas_object_to_float(self):
table = Table(df)
assert table.schema() == {
"index": int,
"a": float # None -> np.nan which is a float
"a": int
}
assert table.view().to_dict()["a"] == [None, 1.0, None, 2.0, None, 3.0, 4.0]

Expand Down