repl.it
@justinholman/

ImportCSV_baseball

Python

2013 MLB data

fork
loading
Files
  • main.py
  • mlb13.csv
  • re.csv
  • re1.csv
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import pandas as pd

baseball = pd.read_csv('mlb13.csv',index_col=0)

# print data for one row (team)
print(baseball)
print(baseball.loc['COL'])

# print data for one column (variable)
era_column = baseball.iloc[:,[2]]
rbi_column = baseball.iloc[:,[3]]
print(era_column)
print(rbi_column)
# two at a time
print(baseball.iloc[:,[2,3]])

print("Calculate mean and std dev:")
era_mean = era_column.mean()
era_std = era_column.std()
print(era_mean)
print("mean" + str(round(era_mean,2)))
print("std dev" + str(round(era_std,2)))

realestate = pd.read_csv('re.csv',index_col=0)
print(realestate)
?