Skip to content

Commit

Permalink
Added a test for bug modin-project#1743
Browse files Browse the repository at this point in the history
This test runs inplace sort of dataframe that has non-numerical index

Signed-off-by: Gregory Shimansky <[email protected]>
  • Loading branch information
gshimansky committed Jul 20, 2020
1 parent 200b275 commit f7014fd
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions modin/pandas/test/test_dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -5945,10 +5945,27 @@ def test_sort_values_with_duplicates(self):
pandas_df = pandas.DataFrame({"col": [2, 1, 1]}, index=[1, 1, 0])

key = modin_df.columns[0]
modin_result = modin_df.sort_values(key, inplace=False,)
pandas_result = pandas_df.sort_values(key, inplace=False,)
modin_result = modin_df.sort_values(key, inplace=False)
pandas_result = pandas_df.sort_values(key, inplace=False)
df_equals(modin_result, pandas_result)

modin_df.sort_values(key, inplace=True)
pandas_df.sort_values(key, inplace=True)
df_equals(modin_df, pandas_df)

def test_sort_values_with_string_index(self):
modin_df = pd.DataFrame({"col": [25, 17, 1]}, index=["ccc", "bbb", "aaa"])
pandas_df = pandas.DataFrame({"col": [25, 17, 1]}, index=["ccc", "bbb", "aaa"])

key = modin_df.columns[0]
modin_result = modin_df.sort_values(key, inplace=False)
pandas_result = pandas_df.sort_values(key, inplace=False)
df_equals(modin_result, pandas_result)

modin_df.sort_values(key, inplace=True)
pandas_df.sort_values(key, inplace=True)
df_equals(modin_df, pandas_df)

def test_where(self):
frame_data = random_state.randn(100, 10)
pandas_df = pandas.DataFrame(frame_data, columns=list("abcdefghij"))
Expand Down

0 comments on commit f7014fd

Please sign in to comment.