This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import pandas as pd | |
train = pd.read_csv("data/train (bike).csv") | |
print(train.shape) | |
train.head() | |
train = pd.read_csv("data/train (bike).csv", parse_dates=["datetime"]) | |
print(train.shape) | |
## Data processing | |
train["year"] = train["datetime"].dt.year |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 10.2 Write a program to read through the mbox-short.txt and figure out the distribution by hour of the day for each of the messages. You can pull the hour out from the 'From ' line by finding the time and then splitting the string a second time using a colon. | |
#From [email protected] Sat Jan 5 09:14:16 2008 | |
# Once you have accumulated the counts for each hour, print out the counts, sorted by hour as shown below. | |
name = input("Enter file:") | |
if len(name) < 1: | |
name = "mbox-short.txt" | |
handle = open(name) | |
counts = dict() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tensorflow as tf | |
import numpy as np | |
tf.set_random_seed(777) # for reproducibility | |
learning_rate = 0.0001 | |
xy = np.loadtxt('multiTimeline_bitcoin_2_normalized.csv', delimiter=',', dtype=np.float32) | |
X_data = xy[:, 0:-1] | |
def MinMaxScaler(x_data): | |
numerator = x_data - np.min(x_data, 0) | |
denominator = np.max(x_data, 0) - np.min(x_data, 0) | |
return numerator / (denominator + 1e-10) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tensorflow as tf | |
import numpy as np | |
tf.set_random_seed(777) # for reproducibility | |
# Predicting animal type based on various features | |
xy = np.loadtxt('ted_main_ranking_viewer.csv', delimiter=',', dtype=np.float32) | |
X_data = xy[:, 0:-1] | |
def MinMaxScaler(x_data): | |
numerator = x_data - np.min(x_data, 0) | |
denominator = np.max(x_data, 0) - np.min(x_data, 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib.request as ur | |
import json | |
page_name='MBC' | |
base="https://graph.facebook.com/v2.8/" | |
page_id='240263402699918' | |
from_date='2018-01-01' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# developers/facebook.com 으로 접속 | |
import urllib.request as ur | |
import json | |
page_name='jtbcnews' | |
base = "https://graph.facebook.com/v2.8" | |
app_id = "200920440387013" | |
app_secret = "daccef14d5cd41c0e95060d65e66c41d" | |
access_token = app_id+"|"+app_secret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from lxml.html import parse | |
from io import StringIO | |
def rowData(rr, kind): | |
cols = rr.findall('.//'+kind) | |
res = [vv.text_content().replace("\t","").replace("\n","") for vv in cols] | |
return res[:-1] | |
def rowWrite(rr): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from lxml.html import parse | |
from io import StringIO | |
url='http://finance.naver.com/sise/sise_market_sum.nhn' | |
text = requests.get(url) | |
ppp = parse(StringIO(text.text)) | |
doc = ppp.getroot() | |
tables = doc.findall('.//table') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
largest = None | |
smallest = None | |
while True: | |
inp = raw_input("Enter a number: ") | |
if inp == "done" : break | |
try: | |
num = float(inp) | |
except: | |
print ("Invalid input") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def order(ih,name='아시아노'): | |
dd = {'아메리카노': 2000, | |
'아프리카노': 3000, | |
'아시아노': 3500} | |
print(name, ih, dd[name]) | |
order('아이스','아메리카노') | |
order('핫','아프리카노') | |
order('아이스') | |
print('----실습----') |
NewerOlder