File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Deployment/Linear_regression Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 1212from sklearn .linear_model import LinearRegression
1313from sklearn import metrics
1414
15- data_filename = 'USA_Housing .csv'
15+ data_filename = 'USA_housing .csv'
1616cwd = os .getcwd ()
1717
1818# Checks if the dataset is in the local '/data' folder
1919# If not present, pulls from Github repo, otherwise reads from the local folder
20- if 'data' not in os .listdir ( ) or data_filename not in os .listdir ("data/ " ):
20+ if not os .path . isdir ( cwd + "/data" ) or data_filename not in os .listdir (cwd + "/data " ):
2121 url = "https://raw.githubusercontent.com/tirthajyoti/Machine-Learning-with-Python/master/Datasets/USA_Housing.csv"
2222 print ("Downloading data from {} " .format (url ))
2323 s = requests .get (url ).content
2424
2525 df = pd .read_csv (io .StringIO (s .decode ('utf-8' )))
2626 print ("Dataset is downloaded." )
2727 # Save the data in local '/data' folder
28- os .makedirs (cwd + "/data" )
28+ if not os .path .isdir (cwd + "/data" ):
29+ os .makedirs (cwd + "/data" )
2930 df .to_csv ("data/USA_housing.csv" )
3031 print ()
3132else :
32- df = pd .read_csv ("data/USA_Housing .csv" )
33+ df = pd .read_csv ("data/USA_housing .csv" )
3334 print ("Dataset loaded from local directory" )
3435 print ()
3536
You can’t perform that action at this time.
0 commit comments