Skip to content

Commit

Permalink
outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
wolff01 committed May 4, 2024
1 parent 7aa3380 commit 5f3c908
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/data.csv
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
"Betts, Mookie","605141","2023","482",".425",".485","230","803"
"Nimmo, Brandon","607043","2023","451",".335",".479","267","939"
"Vierling, Matt","663837","2023","369",".322",".428","293","645"
"Goldschmidt, Paul","502671","2023","435","35.6",".508","382","870"
"Goldschmidt, Paul","502671","2023","435",".356",".508","382","870"
"Garcia, Maikel","672580","2023","360",".369",".506","195","662"
"France, Ty","664034","2023","471",".369",".386","415","875"
"Kim, Ha-Seong","673490","2023","424",".361",".267","261","799"
Expand Down
18 changes: 9 additions & 9 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import streamlit as st
import pandas as pd

def sum_csv_part(filename, start_row, end_row, start_col, end_col):
def sum_csv(filename, start_row, end_row, start_col, end_col):
with open(filename, 'r') as file:
csv_reader = csv.reader(file)
data = list(csv_reader)
Expand All @@ -19,7 +19,7 @@ def sum_csv_part(filename, start_row, end_row, start_col, end_col):
sums.append(row_sum)
return sums

def multiply_csv_part(filename, start_row, end_row, start_col, end_col):
def multiply_csv(filename, start_row, end_row, start_col, end_col):
with open(filename, 'r') as file:
csv_reader = csv.reader(file)
data = list(csv_reader)
Expand All @@ -36,10 +36,10 @@ def multiply_csv_part(filename, start_row, end_row, start_col, end_col):
products.append(row_product)
return products

def divide_csv_part(filename, start_row, end_row, start_col, end_col):
sums = sum_csv_part(filename, start_row, end_row, start_col, end_col)
products_1 = multiply_csv_part(filename, start_row, end_row, 3, 4)
products_2 = multiply_csv_part(filename, start_row, end_row, 3, 5)
def divide_csv(filename, start_row, end_row, start_col, end_col):
sums = sum_csv(filename, start_row, end_row, start_col, end_col)
products_1 = multiply_csv(filename, start_row, end_row, 3, 4)
products_2 = multiply_csv(filename, start_row, end_row, 3, 5)

division_results_1 = []
division_results_2 = []
Expand All @@ -60,7 +60,7 @@ def divide_csv_part(filename, start_row, end_row, start_col, end_col):

st.title("Swing Efficiency %")

a = {'Names': print_csv_row_range(filename, 1, 135),'Swing Efficiency %': column_names}
a = {'Names': csv_row_range(filename, 1, 135),'Swing Efficiency %': column_names}
df = pd.DataFrame.from_dict(a, orient='index')
df = df.transpose()

Expand All @@ -69,7 +69,7 @@ def divide_csv_part(filename, start_row, end_row, start_col, end_col):

st.table(df_sorted)

def print_csv_row_range(filename, start_row_index, end_row_index):
def csv_row_range(filename, start_row_index, end_row_index):
with open(filename, 'r') as file:
csv_reader = csv.reader(file)
rows = list(csv_reader)
Expand All @@ -79,4 +79,4 @@ def print_csv_row_range(filename, start_row_index, end_row_index):
return result


divide_csv_part('data.csv', 1, 135, 6, 7)
divide_csv('data.csv', 1, 135, 6, 7)

0 comments on commit 5f3c908

Please sign in to comment.