Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Guo-Zhang opened this issue Jul 6, 2017 · 11 comments
Open
Labels

Comments

@Guo-Zhang
Copy link
Member

Guo-Zhang commented Jul 6, 2017

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

@AM-GM-LM-PM
Copy link

AM-GM-LM-PM commented Jul 6, 2017

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
Copy link

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
Copy link
Member Author

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

@AM-GM-LM-PM
Copy link

AM-GM-LM-PM commented Jul 6, 2017

@Yuyang-Li
Copy link

@yuezhongxincpp
Copy link

@felixglory
Copy link

@sinnfashen
Copy link

sinnfashen commented Jul 8, 2017

@zhuangjianwei
Copy link

zhuangjianwei commented Jul 8, 2017

@ZedongHao
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

10 participants