0

I am converting a excel file to a text file with custom delimeter. However, the output is not what I want to achieve.

  1. Instead of getting 1|2|3|, I am getting 1|2|3 instead. How can I add the pipe after the 3?
  2. the number inside one of the columns of the excel file is 001. However, after conversion it became 1. How can I retain 001?

Please help me with the following queries I have above. I have also attached snippets of my code .Thank you

text_file = pd.read_excel(uploadedFile, sheet_name=0)
text_file.to_csv(name + '.txt', header = False, sep='|'
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – user11717481 Sep 19 '22 at 09:49
  • `1|2|3|` would mean that the first column contains `1`, the second - `2`, the third - `3`, and the _fourth_ (!) is empty. Thus, you'll need to add an empty column to your dataset. – ForceBru Sep 19 '22 at 10:47
  • @ForceBru how can i add an empty column to my dataset in python? – Help_me Sep 20 '22 at 01:14
  • @Help_me https://stackoverflow.com/questions/16327055/how-to-add-an-empty-column-to-a-dataframe – ForceBru Sep 20 '22 at 09:02

0 Answers0