在磁盘上而不是内存中对大型csv文件进行排序

csvsorter的Python项目详细描述


CSV分拣机

python 3的csvsort分叉。 用于排序磁盘上不适合内存的csv文件。合并排序算法用于将原始文件分解为较小的块,在内存中对这些块进行排序,然后合并这些排序的文件。

示例用法

>>>fromcsvsorterimportcsvsort>>># sort this CSV on the 5th and 3rd columns (columns are 0 indexed)>>>csvsort('test1.csv',[4,2])>>># sort this CSV with no header on 4th column and save results to separate file>>>csvsort('test2.csv',[3],output_file='test3.csv',has_header=False)>>># sort this TSV on the first column and use a maximum of 10MB per split>>>csvsort('test3.tsv',[0],max_size=10,delimiter='\t')>>># sort this CSV on the first column, force quotes around every field (default is csv.QUOTE_MINIMAL) and use windows-1250 encoding>>>importcsv>>>csvsort('test4.csv',[0],quoting=csv.QUOTE_ALL,encoding='windows-1250')

安装

$ pip install csvsorter

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
添加组件后,java JTable为空   java将json发送到php并插入mysql,但返回null   java Spring引导JNDI CommonJ资源   从不同PC创建和合并后的Java servlet问题   java如何在使用findelements时从xpath获取文本   java使用spring boot使用gmail smtp发送电子邮件   java在不使用pojo、bean或getter和setter的情况下获取Json标题的Json数组   Java中的OpenFile对话框将null作为响应   JavaBuilder模式。扩展接口   java中无需替换的数据结构选取   java如何评价Encog中的预测神经网络   java如何在安卓中使用实际的HttpURLConnection进行单元测试?   java使用XML配置禁用WebSocket中的CSRF保护   java如何通过hibernate从多表查询中获取数据?   mysql如何在java中获取更新的行Id   java AEM/CQ组件单一组件/有限组件   java FFmpeg Javacv延迟问题   显示整数数组的java不起作用