計算數值出現的次數
import cufflinks as cf cf.go_offline() import numpy as np import pandas as pd set_slippage_avg_cost = [22.01, 20.98, 17.11, 9.06, 9.4, 3.65, 19.65, 7.01, 11.21, 10.3, 5.1, 23.98, 12.03, 8.13, 8.07, 9.28, 3.93, 4.23, 18.6, 8.22, 7.85, 5.39, 29.4, 43.96, 6.12, 15.03, 2.68, 14.25, 7.9, 2.22, 15.74, 8.83, 8.18, 7.21, 30.38,25.46, 8.53, 8.05, 11.04, 24.95, 5.19, 6.8, 8.19, 5.44, 21.05, 7.06, 6.67, 18.61, 5.44, 2.9] no_slippage_avg_cost = [22.04,21.01,17.13,9.07,9.41,3.65,19.67,7.02,11.22,10.31,5.11,24.01,12.04,8.14,8.08,9.29,3.93,4.24,18.62,8.23,7.86,5.4,29.44,44.01,6.13,15.05,2.68,14.27,7.91,2.22, 15.76, 8.84, 8.19, 7.22, 30.42, 25.49, 8.54, 8.06, 11.05, 24.98, 5.2, 6.81, 8.2, 5.45, 21.08, 7.07, 6.68,18.63,5.45,2.9] diff = (np.array(no_slippage_avg_cost) - np.array(set_slippage_avg_cost)) / np.array(set_slippage_avg_cost) pd.Series(diff).iplot(kind='histogram', bins=100, title='(np.array(no_slippage_avg_cost) - np.array(set_slippage_avg_cost)) / np.array(set_slippage_avg_cost)')
圖
以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。
更多文章、技術交流、商務合作、聯系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號聯系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元
