Python Forum
How to put data into a right variable -CSV - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: How to put data into a right variable -CSV (/thread-653.html)



How to put data into a right variable -CSV - klllmmm - Oct-27-2016

I have exported some data to CSV from a PDF file using PDF multitool.

Sample file of the CSV data

There are some errors in the CSV as it want properly comes into right column.

I have kept only the first page headers as the other pages headers also not in right order, so ignored.

It is great if someone can help to create a python code to make a proper data set.


RE: How to put data into a right variable -CSV - Larz60+ - Oct-27-2016

Please post code you have written so we can help.
Please include all error outputs (full traceback)


RE: How to put data into a right variable -CSV - klllmmm - Oct-27-2016

I'm still trying to do it using python.
Headings are:
A/C Code, Account Description, Old A/C Code, O/B Debit, O/B Credit, Current Month Debit, Current Month Credit, C/B Debit, C/B Credit

I can tabulate Last 7 variables using excel formula.
Form the right I count to number of cells contain values, if it is one took vales to last variable, if it two values taken to second from last, like did up to "old A/C code"(ie 7 from last variable)
And then copy the formula to other cells.

Like to do this using python, I have to learn more on this.


RE: How to put data into a right variable -CSV - Larz60+ - Oct-27-2016

Ok, looks like you really wan't to keep am Excel format. You can do this with PyExcel. See https://pypi.python.org/pypi and search for Excel.
There are quite a few packages. I have had good luck with PyExcel, some only read, others only write. PyExcel does both.