xmucpp / cpp_courses

CPP courses
0 stars 0 forks source link

Homework Submission 2017-07-06: Lecture 1, Python Data Analysis #2

Open Guo-Zhang opened 7 years ago

Guo-Zhang commented 7 years ago

Please submit your homework for Lecture 1 of Python Data Analysis on 2017-07-06 here.

AM-GM-LM-PM commented 7 years ago

Member List: √ Li Liu √ Yuyang Li √ Xingyu Zhu √ Zedong Hao √ Hao Jiang Weiran Li √ Hanlin Tang Zhiruo Wang Tian Xie √ Zhongxin Yue Yilin Zhang √ Yunfeng Zhou √ Jianwei Zhuang

AustinJiangH commented 7 years ago
import numpy as np 
import pandas as pd 

# 二项分布数组
arr = np.random.binomial(1, 0.5, size = (26,4))

# 大于0.5的数字
arr2 = arr[arr>0.5]

# 转化为dataframe
letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
df = pd.DataFrame(arr, index = letters, columns = ['one','two','three','four'])

# 按照two的降序排列 取前五个
df2 = df.sort_values(['two'], ascending = False).iloc[0:5,:]

# 取 one 列
one = df['one']
oneMean = one.mean()
oneSum = one.sum()
oneMid = one.median()
oneVar = one.var()
Guo-Zhang commented 7 years ago

@AustinJiangH Very good! Try to use Pythonic way to get 26 letters. You can try string standard package in Python.

AM-GM-LM-PM commented 7 years ago

https://github.com/AM-GM-LM-PM/homework_dataanalysis Li Liu

Yuyang-Li commented 7 years ago

https://github.com/Yuyang-Li/training

yuezhongxincpp commented 7 years ago

https://github.com/yuezhongxincpp/small-demo/blob/master/yuezhongixn.ipynb

felixglory commented 7 years ago

Xingyu Zhu https://github.com/felixglory/assignments_SU_semester

sinnfashen commented 7 years ago

Hanlin Tang https://github.com/sinnfashen/course/blob/master/homework1.ipynb

zhouyunfengcpp commented 7 years ago

https://github.com/zhouyunfengcpp/CPPHomework/blob/master/Homework2----%E5%91%A8%E9%9F%B5%E4%B8%B0.ipynb

zhuangjianwei commented 7 years ago

https://github.com/zhuangjianwei/1/blob/master/Homework---1.ipynb

ZedongHao commented 7 years ago

Zedong HAO https://github.com/ZedongHao/Assignment/blob/master/Assignment_1_ZedongHao