-
Notifications
You must be signed in to change notification settings - Fork 20
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
base: master
Are you sure you want to change the base?
Conversation
@@ -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')] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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')] |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this 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')] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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')] |
There was a problem hiding this comment.
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?
PR for #188
Currently created a test case to showcase the error and how it is happening