简体   繁体   English

从 CSV 读取并计算平均值(python)

[英]Reading from CSV and calculating average (python)

I am really struggling with a programming task I have been handed, I have been asked to read from a CSV file which shows the names of beaches and a rating and then work out the average rating.我真的在为我接到的一个编程任务而苦苦挣扎,我被要求从一个 CSV 文件中读取数据,该文件显示了海滩的名称和评级,然后计算出平均评级。 Any help I could get with this would be great also I the task given to me am at a beginner level so please don't judge.我能得到的任何帮助都会很棒,而且我的任务处于初学者水平,所以请不要判断。

For reading CSV files, check out Python's standard library csv ( https://docs.python.org/3.7/library/csv.html )要读取 CSV 文件,请查看 Python 的标准库csv ( https://docs.python.org/3.7/library/csv.html )

This content will have enough tutorials and readings that will guide you through your assignment.此内容将包含足够的教程和阅读材料,可指导您完成作业。

As for taking sums and averages, Python's built-in functions( https://docs.python.org/3.7/library/functions.html ) will do you enough good.至于求和和求平均值,Python 的内置函数 ( https://docs.python.org/3.7/library/functions.html ) 对你来说已经足够了。

If you are stuck with any of them, feel free to add comments.如果您对其中任何一个感到困惑,请随时添加评论。

Good luck!祝你好运!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM