我需要一个代码的帮助,该代码从我拥有的一个大型csv文件中获取用户所需的特定列的输入。在自己键入所需的列后,还必须键入整数输入。该整数输入将为他们提供该列出现次数最少的结果数。例如,如果他们键入:hospital_name,“5”,它将向他们显示5个不同的医院(该列下至少有50个不同的医院名称),这些医院的最低计数与他们挂钩。我将编写一个输入和输出示例:
键入所需的列:医院名称 输入您想要的最低结果数:3
输出可能如下所示:
400 births are tied to Gains Hospital
347 births are tied to Petri Hospital
200 births are tied to Brit Hospital
整个csv是一个关于出生的报告,因此您必须计算一个项目在每列中出现的次数,并报告(大多数低计数)
我已经使用“with”读取了我的csv文件
我有困难,使循环连接所有这一切。 我知道用户输入本身将是input()和int(input()),但这并不能将我连接回csv文件
代码
测试
由逗号分隔的CSV数据组成,包含三列:出生、医院、位置
运行示例:
使用插入排序更新Find Max
相关问题 更多 >
编程相关推荐