forked from modin-project/modin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FIX-modin-project#2322: fix case with duplicated index
Signed-off-by: Anatoly Myachev <[email protected]>
- Loading branch information
Showing
5 changed files
with
60 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Licensed to Modin Development Team under one or more contributor license agreements. | ||
# See the NOTICE file distributed with this work for additional information regarding | ||
# copyright ownership. The Modin Development Team licenses this file to you under the | ||
# Apache License, Version 2.0 (the "License"); you may not use this file except in | ||
# compliance with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software distributed under | ||
# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF | ||
# ANY KIND, either express or implied. See the License for the specific language | ||
# governing permissions and limitations under the License. | ||
|
||
import modin.pandas as pd | ||
|
||
|
||
def test_aligning_blocks(): | ||
# Test problem when modin frames have the same number of rows, but different | ||
# blocks (partition.list_of_blocks). See #2322 for details | ||
accm = pd.DataFrame(["-22\n"] * 162) | ||
accm = accm.iloc[2:, :] | ||
accm.reset_index(drop=True, inplace=True) | ||
accm["T"] = pd.Series(["24.67\n"] * 145) | ||
|
||
# see #2322 for details | ||
repr(accm) | ||
|
||
|
||
def test_aligning_blocks_with_duplicated_index(): | ||
# Same problem as in `test_aligning_blocks` but with duplicated values in index. | ||
data11 = [0, 1] | ||
data12 = [2, 3] | ||
|
||
data21 = [0] | ||
data22 = [1, 2, 3] | ||
|
||
df1 = pd.DataFrame(data11).append(pd.DataFrame(data12)) | ||
df2 = pd.DataFrame(data21).append(pd.DataFrame(data22)) | ||
|
||
repr(df1 - df2) |