读取.csv数据/写入另外一个.csv (Python)
来源:互联网 发布:巨人网络2016财报 编辑:程序博客网 时间:2024/05/17 22:26
def test(src, dst, index): with open(dst, 'wb') as df: with open(src, 'rb') as csvfile: # 使用reader函数,接收一个可迭代的对象 reader = csv.reader(csvfile) # 列表解析 rows = [row for row in reader] # 根据索引提取其中某一列 column = [row[index]for row in reader] # 初始化一个二维矩阵 b = numpy.array(rows) # (125973, 41) # 将list中的字符转为数字 column_f = map(float, column) # 给每个列表中的每个元素进行归一化 # for i in column_f: # newValue = (i - min(column_f)) / (max(column_f) - min(column_f)) # print(newValue) writer = csv.writer(df) # 执行写操作 writer.writerows(column) # 关闭文件 df.close()if __name__ == "__main__": test('ss.csv', 'test.csv', 0)
0 0
- 读取.csv数据/写入另外一个.csv (Python)
- python读取、写入csv数据:csv模块
- python 读取csv和写入csv
- python数据写入csv问题
- java将float数据写入csv 并在python中读取csv文件
- python实现txt/csv的读取和写入txt/csv!
- 使用Python读取和写入CSV文件
- 使用Python读取和写入CSV文件
- python 读取和写入csv文件
- CSV读取和写入
- 创建一个csv文件,并写入数据
- python csv文件写入
- python 写入csv文件
- Python 写入CSV文件
- Python csv文件写入
- 使用python pandas读取csv文件数据
- python的读取csv文件数据
- java 读取 写入 csv 文件
- PAT-B 1006. 换个格式输出整数
- The True Cost of Calls
- leetcode题集——sudoku-solver
- HDD is Outdated Technology
- 训练之DP-Doing homework
- 读取.csv数据/写入另外一个.csv (Python)
- java链表的数据结构和二叉树的实现
- (OK)(OK) Install Docker on Fedora 23
- 1.简介
- Java中的继承:父类和子类的关系
- Leetcode Unique Paths
- JavaScript 高级框架设计
- ROW_NUMBER()的用法
- SPAF