需求:原本的csv文件的栏目太多了,裁减成所需的栏目;
使用pandas进行操作非常快:这是Chatgpt说的关于pandas和SQL的区别:
In summary, SQL and Pandas have different strengths and use cases. SQL is best suited for working with large, structured datasets stored in a database, while Pandas is best suited for working with smaller datasets stored in memory or in a variety of file formats. Pandas provides a more flexible and intuitive data structure, along with a rich set of functions and methods for data analysis and manipulation.
pandas的特点是用来处理文件类型的数据;
使用drop就能够删除不要的列了
import pandasdf = pandas.read_csv("./RFIDRingIDBindingTableSample.txt")print(df.head(5))df = df.drop(columns=['Device'])print(df.head(5))df.to_csv('./RFIDRingIDBindingTable.txt', header=None, index=None, sep=' ', mode='a')