首页 > 其他 > 详细

Statistics and Linear Algebra 6

时间:2016-12-08 09:30:14      阅读:164      评论:0      收藏:0      [点我收藏+]

1. Two ways to get a column of another column with max/min values:

  a. most_bars_country = flags["name"][flags["bars"].idxmax()]

  b. bars_sorted = flags.sort_values("bars", ascending=[0])

    most_bars_country = bars_sorted["name"].iloc[0]

2. The way to get the probability of a certain value in a column:

  orange_probability = flags[flags["orange"]==1].shape[0]/flags.shape[0]

3. The way to calculate combination by using factorial 

  import math
  def find_outcome_combinations(N, k): # Calculate the numerator of our formula.
    numerator = math.factorial(N) # Calculate the denominator.
    denominator = math.factorial(k) * math.factorial(N - k) # Divide them to get the final value.
    return numerator / denominator

4. 

Statistics and Linear Algebra 6

原文:http://www.cnblogs.com/kingoscar/p/6143510.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!