Pythonの新機能です。調査の結果を得るには何か助けが必要です。CSVファイル用のPythonカウンタ
Person, Gender, Q1, Q2, Q3
professor, male, agree, not agree, agree
professor, male, agree, agree, agree
professor, female, neutral, not agree, agree
Professor, female, agree, agree, agree
student, female, agree, not agree, not agree
student, female, no answer, not agree, agree
student, male, no answer, no answer, agree
私は別の答えは、人と性別ごとの発生回数をカウントしたい:私はこのようになりますCSVファイルを、持っています。たとえばQ1:(教授、男性:同意、2)、(教授:女性、同意する:1、中立:1)など。 私はこれまでのところ、これを試してみました:
import csv
from collections import Counter
with open('survey.csv') as csvfile:
reader = csv.reader(csvfile, delimiter=',', dialect = csv.excel_tab)
counts = Counter(map(tuple,reader))
print [row for row in reader if row]
print list(csv.reader(csvfile))
しかし、私は文字列のみを持っているので、私はどんな結果を得ることはありませんと思います。さらに、私はまだ人/性別でデータを取得する方法を知らない。 ありがとうございます!
これは['pandas'](http://pandas.pydata.org/pandas-docs/stable/10min.html)を使用すると非常に簡単になります – Peter9192