本文介绍了性能差异在pandas read_table与read_csv与from_csv与read_excel?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我倾向于将.csv文件导入到pandas中,但有时候我可能会获得其他格式的数据来创建 DataFrame 对象。

I tend to import .csv files into pandas, but sometimes I may get data in other formats to make DataFrame objects.

今天,我刚刚发现了 read_table 作为其他格式的通用导入器,并想知道在熊猫的各种方法之间是否有显着的性能差异用于读取.csv文件,例如 read_table from_csv read_excel

Today, I just found out about read_table as a "generic" importer for other formats, and wondered if there were significant performance differences between the various methods in pandas for reading .csv files, e.g. read_table, from_csv, read_excel.


  1. 这些方法比 read_csv 有更好的性能吗?

  2. read_csv from_csv 大不相同,用于创建 DataFrame

  1. Do these other methods have better performance than read_csv?
  2. Is read_csv much different than from_csv for creating a DataFrame?


推荐答案


  1. read_table read_csv (含 sep =',' sep ='\t',它们是两个围绕相同函数的thin包装,所以性能将是相同的。 read_excel 使用 xlrd 包将xls和xlsx文件读入DataFrame,它不处理csv文件。 / li>
  2. from_csv 调用 read_table ,所以不需要。

  1. read_table is read_csv with sep=',' replaced by sep='\t', they are two thin wrappers around the same function so the performance will be identical. read_excel uses the xlrd package to read xls and xlsx files into a DataFrame, it doesn't handle csv files.
  2. from_csv calls read_table, so no.

这篇关于性能差异在pandas read_table与read_csv与from_csv与read_excel?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 14:20