我想读取CSV文件。你知道吗
在第一列的.CSV文件中,我有一个不同的变量(例如,N11,N12,N21,N22,…,N38)。在第3列中,我对每个变量有不同的值。第3列中的值是随机放置的(不是按任何顺序)。你知道吗
我想得到每个变量的最小值和最大值(N11,N12…等等)。 例如,示例数据中给出了N11最小值=1573231694和N11最大值=1573231738。你知道吗
在.csv文件中,每个变量包含数千个元组,如下所示:
我在试下面的代码。有人能帮我根据以上要求修改下面的代码吗?
import csv
with open('example.csv') as csvfile:
readCSV = csv.reader(csvfile, delimiter=',')
for row in readCSV:
print(row[2])
谢谢你。你知道吗
我个人建议你使用熊猫模块。你知道吗
您可以轻松地创建数据结构和管理数据库。它是一个开源库,为Python编程语言提供高性能、易于使用的数据结构和数据分析工具。你知道吗
请在此处查看有关使用熊猫的文档: https://pandas.pydata.org/pandas-docs/stable/
对于这个特殊的问题,你可以:
这将创建一个名为“dataframe”的定制数据结构(显然,选择完全取决于您),它的数据可以轻松有效地进行操作
输出:N11最大值=15 N11最小值=11
工作样品
假设
代码,注释和解释
输出
相关问题 更多 >
编程相关推荐