Python中 怎么对csv中的某一列进行取lg呢?

2025-04-14 17:37:33
推荐回答(3个)
回答1:

这取决于你csv文件是怎么读进来的。
是直接open()读入的
还是用numpy读入的
或者使用pyexcel读入的呢?
每个包对于列的操作各不相同。

回答2:

pip install pyexcel
读取文件以后,在重新写入文件就可以了。
import pyexcel as pe
import pyexcel.ext.xls # import it to handle xls file
import pyexcel.ext.xlsx # import it to handle xlsx file
records = pe.get_records(file_name="your_file.xls")
for record in records:
print("%s is aged at %d" % (record['Name'], record['Age']))

回答3:

lg 是个神马操作呢 哈哈哈哈