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 | |
import matplotlib.pyplot as plt | |
from sklearn.datasets import load_iris | |
def andrews_curve(data, weights=None): | |
num_variables = data.shape[1] | |
t = np.linspace(0, 2*np.pi, 100) | |
curve = np.zeros((len(t), 2)) |
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 random | |
sn1 = ['It', 'is', 'a fundraising event', 'which', 'is held', 'on', 'a Friday', 'in March', 'every', 'other', 'year'] | |
sn2 = ['Foodbank', 'also supports', 'food drives', 'for', 'individuals', 'who', 'want', 'to', 'share', 'their', 'food', 'with', 'the', 'poor', 'in the', 'country'] | |
sn3 = ['When', 'I', 'called', "Foodbank's office", 'people', 'there', 'let', 'me', 'know', 'in detail', 'how', 'I', 'could', 'donate', 'food', 'to', 'the', 'hungry'] | |
sn4 = ['These thousands', 'of', 'Santas', 'spread', 'the spirit', 'of', 'Christmas', 'to', 'Australian kids', 'who are', 'sick', 'or', 'disadvantaged'] | |
sn5 = ['He', 'led', 'a', 'mostly', 'unremarkable', 'life', ', working', 'as', 'a', 'Paris customs service officer', 'until', 'his', 'late', 'forties'] | |
sn6 = ['The', 'public', 'and', 'critics', 'laughed at', "Rousseau's", 'flat,', 'seemingly', 'childish', 'style', 'of', 'portraying', 'human', 'figures'] | |
sn7 = ['In', 'this', 'way,', 'he', 'created', 'his', 'own', 'mysterious', 'jungle', 'paintings', 'where', |
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 matplotlib.pyplot as plt | |
from mpl_toolkits.mplot3d import Axes3D | |
import numpy as np | |
fig = plt.figure() | |
ax = fig.add_subplot(111, projection='3d') | |
# 첫 번째 구 | |
u, v = np.mgrid[0:2*np.pi:20j, 0:np.pi:10j] | |
x = 1.5 * np.cos(u) * np.sin(v) |
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 random | |
def r(): | |
nums = list(range(1, 26)) | |
random.shuffle(nums) | |
return nums | |
table = [] | |
for i in range(9): | |
table += r() |
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 | |
import urllib | |
#OpenAPI 금융위원회 파생상품시세정보 | |
key = "" | |
#numOfRows : 1 | |
#pageNo : 1 | |
#beginBasDt : ex) 20230215. 2023년 2월 15일~... 현재-1 까지. | |
#resultType : json / xml | |
#serviceKey : key |
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 pandas as pd | |
code_df = pd.read_csv('2021licode.csv') | |
stat_df = pd.read_csv('2021listat.csv') | |
code_df = code_df.drop(code_df.columns[[3,4,5]], axis=1) | |
code_df = code_df.iloc[3:-1] | |
def counted_tag(tag): | |
l = [x for x in stat_df[tag].tolist() if str(x) != 'nan'] |
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
let ids = new Set(arr1.map(d => d.id)); | |
let merged = [...arr1, ...arr2.filter(d => !ids.has(d.id))]; |
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
let sqlite3 = require('sqlite3').verbose(); | |
let db = new sqlite3.Database('a.sqlite'); | |
const user_table = { | |
"id": "INTEGER primary key autoincrement", | |
"email": "TEXT unique", | |
"pw": "TEXT", | |
"name": "TEXT", | |
"teacher": "INTEGER" | |
} |
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
i = 0 | |
l = 0.0 | |
syl = 0.0 | |
v = ['a', 'e','i','o','u'] | |
while(i < 30): | |
s = input() | |
for k in range(len(s)): | |
if(s[k] in v): | |
syl+=1 | |
tmp = len(s) |
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 string | |
def invert(str): | |
result = list(str) | |
j = len(str)-1 | |
for i in range(0, len(str)): | |
if(str[i] in string.punctuation or str[i] == ' '): | |
continue | |
k = 0 |