<jupyter_start><jupyter_text>There are no NA values in the data but there are a lot of 0s<jupyter_code># create a column called season to match up with 2019 file
df['Season'] = 2020
list(df)
df.head()
# starting to explore data and see which team has the most fantasy points in the red zone for 2020 season
df.groupby('Team', as_index=False).agg({"FantasyPointsRZ": "sum"}).sort_values(by=['FantasyPointsRZ'],ascending=False)
# what position has the most fantasy points in the red zone for the 2020 season?
df.groupby('Position', as_index=False).agg({"FantasyPointsRZ": "sum"}).sort_values(by=['FantasyPointsRZ'],ascending=False)
# which defense allowed the most points in the red zone for 2020 season?
df.groupby('OpponentRZ', as_index=False).agg({"FantasyPointsRZ": "sum"}).sort_values(by=['FantasyPointsRZ'],ascending=False)
# which week in the 2020 season had the most fantasy points in the red zone?
df.groupby('Week', as_index=False).agg({"FantasyPointsRZ": "sum"}).sort_values(by=['FantasyPointsRZ'],ascending=False)
# which players had the most fantasy points in the red zone for the 2020 season
df.groupby('Name', as_index=False).agg({"FantasyPointsRZ": "sum"}).sort_values(by=['FantasyPointsRZ'],ascending=False)
pd.set_option("display.max_rows", None, "display.max_columns", None)
df.groupby(['Team', 'Position'])['PassingTouchdownsRZ'].sum()
# pivot data and show 2020 red zone fantasy points by team and position
pd.set_option("display.max_rows", None, "display.max_columns", None)
points_by_team = pd.pivot_table(df, index = ["Team","Position"], values = "FantasyPointsRZ", aggfunc = "sum")
print(points_by_team)
# export data frame to a csv
df.to_csv('2020RedZoneStats_cleaned.csv')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13665315576143602, 'fraction_numerical': 0.021424435437174292, 'mean_word_length': 7.597014925373134, 'pattern_counts': {'":': 5, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '392405', 'license': 'MIT', 'n_tokens_mistral': 610, 'n_tokens_neox': 562, 'n_words': 162, 'path': 'notebooks/cleaning/2020RZcleaning.ipynb', 'repo_name': 'georgetown-analytics/Cloudy-with-a-Chance-of-Football', 'size': '1727'}