This file contains hidden or 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
# 載入資料集 | |
gapdf = pd.read_csv('gapminder.csv') | |
#秀出前 18 筆資料 | |
gapdf.head(18) |
This file contains hidden or 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
country | continent | year | lifeExp | pop | gdpPercap | |
---|---|---|---|---|---|---|
Afghanistan | Asia | 1952 | 28.801 | 8425333 | 779.4453145 | |
Afghanistan | Asia | 1957 | 30.332 | 9240934 | 820.8530296 | |
Afghanistan | Asia | 1962 | 31.997 | 10267083 | 853.10071 | |
Afghanistan | Asia | 1967 | 34.02 | 11537966 | 836.1971382 | |
Afghanistan | Asia | 1972 | 36.088 | 13079460 | 739.9811058 | |
Afghanistan | Asia | 1977 | 38.438 | 14880372 | 786.11336 | |
Afghanistan | Asia | 1982 | 39.854 | 12881816 | 978.0114388 | |
Afghanistan | Asia | 1987 | 40.822 | 13867957 | 852.3959448 | |
Afghanistan | Asia | 1992 | 41.674 | 16317921 | 649.3413952 |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
Name | height | weight | sex | bdate | city | major | ||
---|---|---|---|---|---|---|---|---|
s1234567 | Peter | 175 | 70.45 | 1 | 1980/4/30 | Tainan | CSIE | |
e1234567 | Mary | 163 | 55 | 2 | 1981/12/21 | Taipei | EE | |
f1357689 | John | 180.4 | 80.3 | 1 | 1980/5/30 | Tainan | Stat | |
e1374659 | Keven | 182.5 | 77.6 | 1 | 1980/11/19 | Taipei | EE | |
s7758347 | JoJo | 170.3 | 50.3 | 2 | 1980/1/27 | Taipei | CSIE | |
s1334987 | Emily | 168.5 | 53.6 | 2 | 1982/10/13 | Kaohsiung | CSIE | |
e1384726 | Ubuntu | 177 | 68.3 | 1 | 1981/7/6 | Kaohsiung | EE |
This file contains hidden or 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
country | capital | area | population | ||
---|---|---|---|---|---|
BR | Brazil | Brasilia | 8.516 | 200.4 | |
RU | Russia | Moscow | 17.10 | 143.5 | |
IN | India | New Delhi | 3.286 | 1252 | |
CH | China | Beijing | 9.597 | 1357 | |
SA | South Africa | Pretoria | 1.221 | 52.98 |
This file contains hidden or 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 | |
years = [2014, 2015, 2016, 2017, 2018] | |
p = [1.8, 3.8, 4, 4.5, 2] | |
sp = pd.Series(p, index = years) | |
print(sp) |
This file contains hidden or 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 | |
#建構一個 dictionary | |
dict = { | |
"country":["Brazil", "Russia", "India", "China", "South Africa"], | |
"capital":["Brasilia", "Moscow", "New Delhi", "Beijing", "Pretoria"], | |
"area":[8.516, 17.10, 3.286, 9.597, 1.221], | |
"population":[200.4, 143.5, 1252, 1357, 52.98] } | |
brics = pd.DataFrame(dict) | |
brics |
This file contains hidden or 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
int LIS(vector<int>& LISTbl) | |
{ | |
if (LISTbl.size() == 0) return 0; | |
vector<int> LISLen(LISTbl.size(), 1); | |
for (int i = 1; i < LISTbl.size(); i++) | |
{ | |
for (int j = 0; j < i; j++) | |
{ | |
if (LISTbl[j] < LISTbl[i]) | |
LISLen[i] = max(LISLen[i], LISLen[j] + 1); |
This file contains hidden or 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
void getMaxElementAndPos(vector<int>& LISTbl, | |
vector<int>& LISLen, int tNum, int tlen, | |
int tStart, | |
int & num, int & pos) | |
{ | |
int max = numeric_limits<int>::min(); | |
int maxPos; | |
for (int i = tStart; i >= 0; i--) | |
{ | |
if (LISLen[i] == tlen && LISTbl[i] < tNum) |
This file contains hidden or 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
int LIS(vector<int>& LISTbl) | |
{ | |
if (LISTbl.size() == 0) return 0; | |
vector<int> LISLen(LISTbl.size(), 1); | |
for (int i = 1; i < LISTbl.size(); i++) | |
{ | |
for (int j = 0; j < i; j++) | |
{ | |
if (LISTbl[j] < LISTbl[i]) | |
LISLen[i] = max(LISLen[i], LISLen[j] + 1); |