码迷,mamicode.com
首页 > 其他好文 > 详细

Statistics and Linear Algebra 6

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

标签:color   tor   div   factor   range   asc   end   form   orm   

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

标签:color   tor   div   factor   range   asc   end   form   orm   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!