Hole | Wins | Losses | Score | +19 |
---|---|---|---|---|
1 | 41 | 40 | +4 | (E) |
10 | 30 | 51 | +19 | (+1) |
Avg | 36 | 46 | +42 |
The data appears to be a list of baseball games played by the New York Mets in 2010. The format is consistent and includes the following information for each game:
Here's an example of how to parse this data into something more useful:
import pandas as pd
# Load the data from a string into a pandas DataFrame
data = """...
"""
df = pd.read_csv(data.split('\n'), sep=' - ')
# Clean and format the date column
df['Date'] = pd.to_datetime(df['Date'], format='%B %d, %Y')
# Create columns for home and away games
df['Home'] = df['Opponent'].apply(lambda x: 'Home' if x.split(' ')[0] == 'Mets' else 'Away')
df['Away'] = df['Opponent'].apply(lambda x: 'Home' if x.split(' ')[1] == 'Mets' else 'Away')
# Create a wins column
df['Wins'] = 1 + (df['Score'].str.extract('(\d+)', expand=False).astype(int) > 0)
# Group by Date and Home/Away, then count the number of games in each group
game_counts = df.groupby(['Date', 'Home'], observed=True)['Wins'].count().reset_index()
print(game_counts)
This will create a DataFrame with the date and whether the game was home or away, along with the total number of wins for each combination.
For example:
Date | Home | Wins |
---|---|---|
2010-09-12 | Home | 1 |
2010-09-13 | Away | 1 |
... | ... | ... |
You could use this data to calculate metrics such as the number of games won, lost, or tied for each opponent, or the overall record for the team. Updated: July 18, 2025 at 4:59 AM