How to use the maup.assign.assign_by_area function in maup

To help you get started, we’ve selected a few maup examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mggg / maup / tests / test_assign.py View on Github external
def test_gives_same_answer_for_targets_with_non_integer_index(
        self, four_square_grid, squares_df
    ):
        targets = four_square_grid.set_index("ID")
        # targets = four_square_grid
        # sources = squares_df.set_index("ID")
        sources = squares_df
        assignment = assign_by_area(sources, targets)
        expected = assign_by_covering(sources, targets)
        assert (expected == assignment).all()
github mggg / maup / tests / test_assign.py View on Github external
def test_assign_by_area_dispatches_to_non_integer_version(
        self, four_square_grid, squares_df
    ):
        targets = four_square_grid.set_index("ID")
        sources = squares_df.set_index("ID")
        assignment = assign_by_area(sources, targets)
        expected = assign_by_covering(sources, targets)
        assert (expected == assignment).all()
github mggg / maup / tests / test_assign.py View on Github external
def test_gives_expected_answer_when_sources_not_neatly_nested(
        self, four_square_grid, square_mostly_in_top_left
    ):
        assignment = assign_by_area(square_mostly_in_top_left, four_square_grid)
        expected = pandas.Series([1], index=[0])

        assert (expected == assignment).all()
github mggg / maup / tests / test_assign.py View on Github external
def test_gives_same_answer_for_integer_indices(self, four_square_grid, squares_df):
        assignment = assign_by_area(squares_df, four_square_grid)
        expected = assign_by_covering(squares_df, four_square_grid)
        assert (expected == assignment).all()
github mggg / maup / tests / test_assign.py View on Github external
def test_gives_same_answer_for_sources_with_non_integer_index(
        self, four_square_grid, squares_df
    ):
        targets = four_square_grid
        sources = squares_df.set_index("ID")
        assignment = assign_by_area(sources, targets)
        expected = assign_by_covering(sources, targets)
        assert (expected == assignment).all()
github mggg / maup / tests / test_assign.py View on Github external
def test_gives_same_answer_when_both_have_non_integer_indices(
        self, four_square_grid, squares_df
    ):
        targets = four_square_grid.set_index("ID")
        sources = squares_df.set_index("ID")
        assignment = assign_by_area(sources, targets)
        expected = assign_by_covering(sources, targets)
        assert (expected == assignment).all()