Skip to content

Commit

Permalink
Revert "merged and resolved the conflicts"
Browse files Browse the repository at this point in the history
This reverts commit d5b94c3, reversing
changes made to 14fa9a4.
  • Loading branch information
AlenkaF committed Sep 7, 2021
1 parent d5b94c3 commit c06da90
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 24 deletions.
2 changes: 1 addition & 1 deletion packages/vaex-core/vaex/dataframe_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def convert_string_column(col : ColumnObject) -> np.ndarray:
"""
#TODO


# Implementation of interchange protocol
# --------------------------------------

Expand Down
26 changes: 3 additions & 23 deletions tests/dataframe_protocol_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ def test_float_only(df_factory):

assert_dataframe_equal(df.__dataframe__(), df)

def test_mixed_intfloat(df_factory):
df = df_factory(x=[1, 2, 0], y=[9.2, 10.5, 11.8])
df2 = _from_dataframe_to_vaex(df.__dataframe__())

def test_mixed_intfloat(df_factory):
df = df_factory(x=[1, 2, 0], y=[9.2, 10.5, 11.8])
df2 = _from_dataframe_to_vaex(df.__dataframe__())
Expand Down Expand Up @@ -71,6 +67,7 @@ def test_mixed_missing(df_factory_arrow):
x=np.array([True, None, False, None, True]),
y=np.array([None, 2, 0, 1, 2]),
z=np.array([9.2, 10.5, None, 11.8, None]))

df2 = _from_dataframe_to_vaex(df.__dataframe__())

assert df.__dataframe__().metadata == df2.__dataframe__().metadata
Expand All @@ -97,12 +94,7 @@ def test_missing_from_masked(df_factory_numpy):
x=np.ma.array([1, 2, 3, 4, 0], mask=[0, 0, 0, 1, 1], dtype=int),
y=np.ma.array([1.5, 2.5, 3.5, 4.5, 0], mask=[False, True, True, True, False], dtype=float),
z=np.ma.array([True, False, True, True, True], mask=[1, 0, 0, 1, 0], dtype=bool))

def test_missing_from_masked(df_factory_numpy):
df = df_factory_numpy(
x=np.ma.array([1, 2, 3, 4, 0], mask=[0, 0, 0, 1, 1], dtype=int),
y=np.ma.array([1.5, 2.5, 3.5, 4.5, 0], mask=[False, True, True, True, False], dtype=float),
z=np.ma.array([True, False, True, True, True], mask=[1, 0, 0, 1, 0], dtype=bool))

df2 = _from_dataframe_to_vaex(df.__dataframe__())

assert df.__dataframe__().metadata == df2.__dataframe__().metadata
Expand Down Expand Up @@ -130,13 +122,6 @@ def test_categorical_ordinal():
colors=colors,
year=[2012, 2013, 2015, 2019],
weekday=[0, 1, 4, 6])

def test_categorical_ordinal():
colors = ['red', 'blue', 'green', 'blue']
ds = vaex.from_arrays(
colors=colors,
year=[2012, 2013, 2015, 2019],
weekday=[0, 1, 4, 6])
df = ds.ordinal_encode('colors', ['red', 'green', 'blue'])
df = df.categorize('year', min_value=2012, max_value=2019)
df = df.categorize('weekday', labels=['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'])
Expand All @@ -157,12 +142,6 @@ def test_categorical_ordinal():
assert col3.describe_categorical == (False, True, {0: 'Mon', 1: 'Tue', 2: 'Wed', 3: 'Thu', 4: 'Fri', 5: 'Sat', 6: 'Sun'})
assert col3.describe_null == (3, 1)
assert col3.dtype == (23, 64, 'u', '=')
col = df.__dataframe__().get_column_by_name('weekday')
assert col.dtype[0] == _DtypeKind.CATEGORICAL
assert col.describe_categorical == (False, True, {0: 'Mon', 1: 'Tue', 2: 'Wed', 3: 'Thu', 4: 'Fri', 5: 'Sat', 6: 'Sun'})
col2 = df.__dataframe__().get_column_by_name('colors')
assert col2.dtype[0] == _DtypeKind.CATEGORICAL
assert col2.describe_categorical == (False, True, {0: 'red', 1: 'green', 2: 'blue'})

df2 = _from_dataframe_to_vaex(df.__dataframe__())
assert df2['colors'].tolist() == ['red', 'blue', 'green', 'blue']
Expand Down Expand Up @@ -258,6 +237,7 @@ def test_VaexDataFrame():
x=np.array([True, True, False]),
y=np.array([1, 2, 0]),
z=np.array([9.2, 10.5, 11.8]))

df2 = df.__dataframe__()

assert df2._allow_copy == True
Expand Down

0 comments on commit c06da90

Please sign in to comment.