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
  Split excel file and write output at specific row and set sheet position DSCA 0 447 May-12-2022, 07:29 PM
Last Post: DSCA
  Export dataframe to xlsx - Error "zipfile.BadZipFile: File is not a zip file" Baggio 10 32,071 Mar-12-2021, 01:02 PM
Last Post: buran
  Python - Merge existing cells of Excel file created with xlsxwriter manonB 0 2,036 Mar-10-2021, 02:17 PM
Last Post: manonB
  Creating more than one excel File at once malvarez1976 0 1,081 Dec-15-2020, 02:04 AM
Last Post: malvarez1976
  XLSX file with multiple sheets to josn file ovidius 2 1,421 Apr-05-2020, 09:22 AM
Last Post: ovidius
  Help batch converting .json chosen file to MySQL BrandonKastning 2 1,464 Mar-14-2020, 09:19 PM
Last Post: BrandonKastning
  Convert Excel to .txt - Need each excel row to be separate .txt file cowboykevin05 2 3,287 Jan-03-2020, 06:29 PM
Last Post: Larz60+
  Python write result of VAR to excel file wissam1974 8 5,765 Jul-13-2019, 01:09 PM
Last Post: wissam1974
  How to add a dataframe to an existing excel file wendysling 2 25,305 May-09-2019, 07:00 PM
Last Post: wendysling
  Import Excel File that Starts with Number kiki1113 1 2,322 Dec-20-2018, 07:13 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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