Python Forum
[split] Converting excel file to txt file
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[split] Converting excel file to txt file
pd.to_string is giving me an error. Is this functionality of pandas still around, or has it been removed? I'm using Python 3. I'm trying to accomplish the same thing the OP was, and stumbled upon this solution that doesn't seem to be working for me. Any help would be appreciated. Thanks!

(Aug-04-2017, 06:23 AM)radioactive9 Wrote: Hello

Since you did not tell what modification you want to make in the file I have no clue what code to write. This will help you to kick start

import pandas as pd
xlsx = pd.read_excel('D:\\Users\\path\\blah_blah.xlsx', sheetname=0, index=0)
'''make necessary changes in the dataframe'''
with open('D:\\Users\\path\\blah_blah.txt','w') as outfile:
yes, pandas.DataFrame.to_string() is still available
Also look at pandas.DataFrame.to_csv()

In order to help we need to see your code as well full traceback you get.
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Thanks! I wasn't looking for help fixing it directly, I was just trying to find out if .to_string should still work, and/or if it ever worked with Python3. Knowing that .to_string isn't something I should expect to work (I need .DataFrame.to_string) is exactly what I was looking for.

Possibly Related Threads…
Thread Author Replies Views Last Post
  Export dataframe to xlsx - Error "zipfile.BadZipFile: File is not a zip file" Baggio 10 14,852 Mar-12-2021, 01:02 PM
Last Post: buran
  Python - Merge existing cells of Excel file created with xlsxwriter manonB 0 1,073 Mar-10-2021, 02:17 PM
Last Post: manonB
  Creating more than one excel File at once malvarez1976 0 669 Dec-15-2020, 02:04 AM
Last Post: malvarez1976
  XLSX file with multiple sheets to josn file ovidius 2 1,083 Apr-05-2020, 09:22 AM
Last Post: ovidius
  Help batch converting .json chosen file to MySQL BrandonKastning 2 1,032 Mar-14-2020, 09:19 PM
Last Post: BrandonKastning
  Convert Excel to .txt - Need each excel row to be separate .txt file cowboykevin05 2 2,602 Jan-03-2020, 06:29 PM
Last Post: Larz60+
  Python write result of VAR to excel file wissam1974 8 4,398 Jul-13-2019, 01:09 PM
Last Post: wissam1974
  How to add a dataframe to an existing excel file wendysling 2 23,232 May-09-2019, 07:00 PM
Last Post: wendysling
  Import Excel File that Starts with Number kiki1113 1 1,796 Dec-20-2018, 07:13 PM
Last Post: Larz60+
  Validate Excel with text in text file Vinci141 3 2,032 Dec-03-2018, 04:03 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020