-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup_google_colab.py
45 lines (35 loc) · 1.39 KB
/
setup_google_colab.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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import pandas as pd
def download_file(url, file_path):
print(url, file_path)
if os.path.exists(file_path):
os.remove(file_path)
template = "wget '{}' -O '{}'"
os.system(template.format(url, file_path))
def download_github_code(path):
repo = 'kaggle_coursera/blob'
branch = 'master'
url = 'https://github.com/migai/{}/{}/{}'
file_path = path.rsplit("/")[-1]
download_file(url.format(repo, branch, path), file_path)
def download_github_with_pd_csv(path, df_name):
repo = 'kaggle_coursera/blob'
branch = 'master'
url = 'https://github.com/migai/{}/{}/{}'
file_path = path.rsplit("/")[-1]
download_file(url.format(repo, branch, path), file_path)
df_name = pd.read_csv(file_path)
def load_data_week1():
download_github_code("week1_PandasBasics/grader.py")
transactions = pd.DataFrame()
items = pd.DataFrame()
item_categories = pd.DataFrame()
shops = pd.DataFrame()
download_github_with_pd_csv("readonly/final_project_data/sales_train.csv.gz", transactions)
download_github_with_pd_csv("readonly/final_project_data/items.csv", items)
download_github_with_pd_csv("readonly/final_project_data/item_categories.csv", item_categories)
download_github_with_pd_csv("readonly/final_project_data/shops.csv", shops)
def load_data_week2():
return