Repository: modin-project/modin

Issue:
modin fails to correctly deliver division results in dataframe rows
### System information
- **OS Platform and Distribution (e.g., Linux Ubuntu 16.04)**: Windows 10
- **Modin version** (`modin.__version__`):  0.9.0
- **Python version**: 3.7.2
- **Code we can use to reproduce**: `new['effratio'] = new['efflen']/new['txtlen']`


### Describe the problem
If you directly use rows in a DataFrame to do division, the result is not correct. I discovered this when I want to calculate a ratio. Some ratio values are larger than 1. I ran the same code with original pandas and it delivered the correct result.

I have listed several items in this dataframe for you to see the problem. See the image.

`new` is a DataFrame object I read in.

![issue](https://user-images.githubusercontent.com/45134013/110804696-5f0b3f80-82bb-11eb-8adc-eab68580be71.png)



Discussion:
Hi @holazzer thanks for the report!

I think I can reproduce the issue locally, it is happening because of non-distinct index values. The source of the problem is this:

```python
import modin.pandas as pd
import numpy as np

df = pd.DataFrame(np.random.randint(0, 100, size=(2**10, 2**6))).add_prefix("col")
df.index = [i // 3 for i in df.index]
df["col0"] / df["col1"]  # this does a join on the index
```

pandas doesn't seem to do the join on the index when the values are duplicated. I will investigate the source of this and get it resolved quickly. 

Thank you @holazzer for the detail, this would have been very difficult to debug without your explanation and figures!
Quick update, when trying to generalize pandas behavior, we are doing the join on the index, but pandas doesn't do an inner join when the index objects are equivalent. It should be a quick fix.

This results in the join in pandas:
```python
df["col0"] / df["col1"].iloc[1:]  # 3x the number of rows
```
but this does not:
```python
df["col0"] / df["col1"]
```

Resolving patch:
diff --git a/modin/engines/base/frame/data.py b/modin/engines/base/frame/data.py
--- a/modin/engines/base/frame/data.py
+++ b/modin/engines/base/frame/data.py
@@ -973,7 +973,7 @@ def merge(left_index, right_index):
                 return left_index.join(right_index, how=how, sort=sort)
 
         # define condition for joining indexes
-        all_indices_equal = all(indexes[0].equals(index) for index in [indexes[1:]])
+        all_indices_equal = all(indexes[0].equals(index) for index in indexes[1:])
         do_join_index = how is not None and not all_indices_equal
 
         # define condition for joining indexes with getting indexers
@@ -1783,8 +1783,6 @@ def get_axis_lengths(partitions, axis):
             return self._partitions, [o._partitions for o in other], joined_index
 
         base_frame_idx = non_empty_frames_idx[0]
-        base_frame = frames[base_frame_idx]
-
         other_frames = frames[base_frame_idx + 1 :]
 
         # Picking first non-empty frame


Test patch:
diff --git a/modin/pandas/test/dataframe/test_binary.py b/modin/pandas/test/dataframe/test_binary.py
--- a/modin/pandas/test/dataframe/test_binary.py
+++ b/modin/pandas/test/dataframe/test_binary.py
@@ -241,3 +241,4 @@ def test_duplicate_indexes():
     )
     modin_df2, pandas_df2 = create_test_dfs({"a": data, "b": data})
     df_equals(modin_df1 / modin_df2, pandas_df1 / pandas_df2)
+    df_equals(modin_df1 / modin_df1, pandas_df1 / pandas_df1)