今天教seaborn真的覺得比matplotlib厲害好多,也教了Requests跟bs4
import seaborn as sns
sns.set_theme()
tip = sns.load_dataset('tips')
Tip_plot = sns.FacetGrid(tip, col = 'time', row = 'sex')
Tip_plot.map(sns.scatterplot, 'total_bill', 'tip')
sns.set_theme()
tip = sns.load_dataset('tips')
Tip_plot = sns.FacetGrid(tip, col = 'time', hue = 'sex')
Tip_plot.map_dataframe(sns.scatterplot, x = 'total_bill', y = 'tip')
Tip_plot.set_axis_labels('Total bill', 'Tip')
Tip_plot.add_legend()
sns.relplot(data = tip, x = 'total_bill', y = 'tip', hue = 'day', style = 'day', size = 'size')
fmri = sns.load_dataset('fmri')
fmri.head()
sns.relplot(data = fmri, x = 'timepoint', y = 'signal', col = 'region', hue = 'event', kind = 'line')
sns.set_theme()
penguins = sns.load_dataset('penguins')
sns.pairplot(data = penguins)
#爬今彩539號碼
from bs4 import BeautifulSoup
import requests
lottery = requests.get('https://www.taiwanlottery.com.tw')
lottery_BS = BeautifulSoup(lottery.text, 'lxml')
Selected01 = lottery_BS.select('#rightdown')
Selected02 = Selected01[0].find('div', {'class': 'contents_box03'})
Selected03 = Selected02.find_all('div', {'class': 'ball_tx'})
print('開出順序', end= ' ')
for i in range(0,6):
print(Selected03[i].text, end= ' ')
print('大小排序', end= ' ')
for i in range(6,11):
print(Selected03[i].text, end= ' ')