Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

summarize_networks InvalidIndexError #191

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ntalluri
Copy link
Collaborator

PR for #188

Currently created a test case to showcase the error and how it is happening

test/ml/test_ml.py Outdated Show resolved Hide resolved
@ntalluri ntalluri requested a review from agitter November 4, 2024 22:57
@@ -78,6 +78,7 @@ def summarize_networks(file_paths: Iterable[Union[str, PathLike]]) -> pd.DataFra
str(tup[0]): 1,
}, index=tup[1]
)
dataframe = dataframe[~dataframe.index.duplicated(keep='first')]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
dataframe = dataframe[~dataframe.index.duplicated(keep='first')]
# Mark the first occurrence of a duplicate as True and all others as False
# Non-duplicates are also marked as True
dataframe = dataframe[~dataframe.index.duplicated(keep='first')]

@@ -78,6 +78,7 @@ def summarize_networks(file_paths: Iterable[Union[str, PathLike]]) -> pd.DataFra
str(tup[0]): 1,
}, index=tup[1]
)
dataframe = dataframe[~dataframe.index.duplicated(keep='first')]
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a warning that edges are being dropped from a file

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is hard to do here, we can think about whether it should be handled somewhere else. For instance, should the parse_output functions check for duplicate edges and raise a warning or error?

Copy link
Collaborator

@agitter agitter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What you have looks good.

If you didn't already open an issue about MinCostFlow giving the duplicate issues that trigged this problem, please do that and link it to #188 (comment). We may want to follow up on that potential bug later.

@@ -78,6 +78,7 @@ def summarize_networks(file_paths: Iterable[Union[str, PathLike]]) -> pd.DataFra
str(tup[0]): 1,
}, index=tup[1]
)
dataframe = dataframe[~dataframe.index.duplicated(keep='first')]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
dataframe = dataframe[~dataframe.index.duplicated(keep='first')]
# Mark the first occurrence of a duplicate as True and all others as False
# Non-duplicates are also marked as True
dataframe = dataframe[~dataframe.index.duplicated(keep='first')]

@@ -78,6 +78,7 @@ def summarize_networks(file_paths: Iterable[Union[str, PathLike]]) -> pd.DataFra
str(tup[0]): 1,
}, index=tup[1]
)
dataframe = dataframe[~dataframe.index.duplicated(keep='first')]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is hard to do here, we can think about whether it should be handled somewhere else. For instance, should the parse_output functions check for duplicate edges and raise a warning or error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants