Closed
Description
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)