简体   繁体   English

如何将txt文件转换成csv文件?

[英]How to convert txt file into csv file?

My.txt file looks like a matrix.It has 82 columns, about 1600 rows,the first column is gene,the first row is sample,the rest is the expression abundance of each gene in each sample.How to convert the txt file into a csv file using Python3?My data: My.txt文件看起来像一个矩阵。它有82列,大约1600行,第一列是基因,第一行是样本,rest是每个样本中每个基因的表达丰度。如何将txt文件转换为使用 Python3 的 csv 文件?我的数据: 在此处输入图像描述

Please follow the Stackoverflow guidelines to ask your question.请按照 Stackoverflow 指南提出您的问题。

I think as long as your columns in the TXT file are separated by a unique character that is not in the data of columns, you can use it as sep in pd.read_csv(..., sep='<character>') .我认为只要您在 TXT 文件中的列由不在列数据中的唯一字符分隔,您就可以在pd.read_csv(..., sep='<character>')其用作sep Most common separators are '\t', ' ', ',', ';'最常见的分隔符是'\t', ' ', ',', ';' . .

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM