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

Pandas concat incorrectly marks subsequent code as unreachable #895

Closed
mahartariq opened this issue Mar 22, 2024 · 1 comment
Closed

Pandas concat incorrectly marks subsequent code as unreachable #895

mahartariq opened this issue Mar 22, 2024 · 1 comment
Labels
duplicate This issue or pull request already exists

Comments

@mahartariq
Copy link

When using the Pandas concat function to concatenate DataFrames, any code following the concat call is mistakenly marked as unreachable, even though it should be executed.

import pandas as pd

def concatenate_dfs(dfs):
final_df = pd.concat(dfs, ignore_index=True)
#Following line should be reachable, but it's marked as unreachable
final_df.reset_index(drop=True, inplace=True)
return final_df

Example usage

dfs = [pd.DataFrame({'A': [1, 2, 3]}), pd.DataFrame({'A': [4, 5, 6]})]
result_df = concatenate_dfs(dfs)
print(result_df)

@Dr-Irv
Copy link
Collaborator

Dr-Irv commented Mar 22, 2024

Duplicate of #888 and fixed in #890

@Dr-Irv Dr-Irv closed this as completed Mar 22, 2024
@Dr-Irv Dr-Irv added the duplicate This issue or pull request already exists label Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants