Skip to content

Pandas concat incorrectly marks subsequent code as unreachable #895

Closed
@mahartariq

Description

@mahartariq

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions