pybaseball
pybaseball copied to clipboard
Fix pandas df.concat FutureWarning statcast.py
Fix pandas concat deprecation FutureWarning
This PR removes a FutureWarning in pybaseball/datahelpers/postprocessing.py related to the use of errors='ignore' in pd.to_datetime, which is being deprecated.
Changes:
- Require non-empty DataFrames before calling concat()
- Maintained the same results while removing the warning
Testing:
- Confirmed the warning no longer appears
Original warning:
pybaseball/statcast.py:85: FutureWarning: The behavior of DataFrame concatenation with empty or all-NA entries is deprecated. In a future version, this will no longer exclude empty or all-NA columns when determining the result dtypes. To retain the old behavior, exclude the relevant entries before the concat operation.
final_data = pd.concat(dataframe_list, axis=0).convert_dtypes(convert_string=False)