Hole | Wins | Losses | Score | +16 |
---|---|---|---|---|
1 | 7 | 2 | -2 | Eagle (-2) |
2 | 6 | 3 | -3 | Birdie (-1) |
3 | 4 | 5 | -2 | Bogey (+1) |
4 | 2 | 7 | +1 | Trpl Bogey (+3) |
5 | 4 | 5 | +2 | Bogey (+1) |
6 | 5 | 4 | +2 | Par (E) |
7 | 4 | 5 | +3 | Bogey (+1) |
8 | 4 | 5 | +4 | Bogey (+1) |
9 | 7 | 2 | +2 | Eagle (-2) |
In: +4 | ||||
10 | 3 | 6 | +4 | Dbl Bogey (+2) |
11 | 4 | 5 | +5 | Bogey (+1) |
12 | 5 | 4 | +5 | Par (E) |
13 | 3 | 6 | +7 | Dbl Bogey (+2) |
14 | 2 | 7 | +10 | Trpl Bogey (+3) |
15 | 4 | 5 | +11 | Bogey (+1) |
16 | 5 | 4 | +11 | Par (E) |
17 | 3 | 6 | +13 | Dbl Bogey (+2) |
18 | 2 | 7 | +16 | Trpl Bogey (+3) |
Out: +13 | ||||
Avg | 4 | 5 | +1 | Bogey |
This is a large text file containing the results of a baseball season. The format appears to be a simple list of wins and losses for each team against each other team, with the date and time of play not explicitly stated but inferred from the timestamp.
The text can be split into several sections:
The data can be represented in a more structured format using a baseball season database schema, which would include the following tables:
Here is a Python example of how this data could be structured and queried:
import pandas as pd
# Load the text data into a pandas DataFrame
data = pd.read_csv('baseball_data.txt', sep='\t')
# Create a new column for the home team
data['Home Team'] = data.apply(lambda row: f"{row['Opponent']} {row['Score'].split('-')[0]}", axis=1)
# Save the data to a database
teams = pd.DataFrame({
'Team ID': [1, 2, 3],
'Name': ['Brewers', 'Cubs', 'Dodgers']
})
season = pd.DataFrame({
'Season ID': [2022],
'Year': [2022]
})
games = pd.DataFrame({
'Game ID': [1, 2, 3],
'Date': data.apply(lambda row: f"{row['Date']}", axis=1),
'Home Team': data['Home Team'],
'Away Team': data.apply(lambda row: f"{data.loc[row.name, 'Opponent']} {row['Score'].split('-')[1]}", axis=1)
})
# Query the database
query = "SELECT * FROM games WHERE Date >= '2022-04-01' AND Date <= '2022-09-30'"
result = games.query(query)
print(result)
This code assumes that the text data is stored in a file called baseball_data.txt
and uses the \t
character as the separator between columns. The data is loaded into a pandas DataFrame and then saved to a database using three separate tables: Teams
, Season
, and Games
. Finally, the code queries the database for games played during the 2022 season and prints the results. Updated: April 25, 2025 at 10:39 AM