尋找一些小項目的幫助。我正在學習Python,而且我完全迷失在一個問題上。請讓我解釋一下。在Python中導入CSV和分析
我有一個包含'Apple股價'的csv文件,到目前爲止我可以使用csv模塊導入Python,但是,我需要分析數據並生成每月平均值並確定最佳和最差的6個月。我的csv列是日期,價格。
非常感謝幫助。
"Date","Open","High","Low","Close","Volume","Adj Close"
"2012-11-14",660.66,662.18,650.5,652.55,1668400,652.55
"2012-11-13",663,667.6,658.23,659.05,1594200,659.05
"2012-11-12",663.75,669.8,660.87,665.9,1405900,665.9
"2012-11-09",654.65,668.34,650.3,663.03,3114100,663.03
"2012-11-08",670.2,671.49,651.23,652.29,2597000,652.29
"2012-11-07",675,678.23,666.49,667.12,2232300,667.12
"2012-11-06",685.48,686.5,677.55,681.72,1582800,681.72
"2012-11-05",684.5,686.86,675.56,682.96,1635900,682.96
"2012-11-02",694.79,695.55,687.37,687.92,2324400,687.92
"2012-11-01",679.5,690.9,678.72,687.59,2050100,687.59
"2012-10-31",679.86,681,675,680.3,1537000,680.3
"2012-10-26",676.5,683.03,671.2,675.15,1950800,675.15
"2012-10-25",680,682,673.51,677.76,2401100,677.76
"2012-10-24",686.8,687,675.27,677.3,2496500,677.3
等等
你能告訴我們一些輸入數據和你到目前爲止的代碼嗎?什麼阻止了你? –
查看http://stackoverflow.com/a/5830435/299031使用namedtuples加載csv數據 – rorycl
查看[pandas](http://pandas.pydata.org/)庫,它可讓您將CSV數據加載到一個表格結構,你可以很容易地計算平均值等等。 – BrenBarn