I have a text file exported out of a Excel document. Along its columns it lists each supplier and in the row below it is there respective pricing. At the end it will list minimum supplier and minimum price. Example:
Project: Name.
Supplier A, Supplier B, Supplier C, Lowest Price, Winning Supplier
600, 900, 650, 600, Supplier A
Since I need to search through hundreds of excel documents and I thought it would be best to create text files of each and process the data in python.
I have gone through the python manual and I’m finding it difficult to get any results. The final result that I want is to be able to process numerous files from a single folder. My objective is to be able to list each supplier and search whether they were successful on each project and if they were not how much differential there was either in dollar terms or percentage from their price to the winning supplier.
Can anyone give some assistance on where to start to build this?
Greggy D
I would probably encapsulate the supplier data in a class:
Then I would parse each datafile individually as:
Now we can build up our dictionary:
And you can get information on that supplier by:
etc.
Of course, there are libraries for parsing
.xlsfiles directly in python which might be more suitable than my hand-rolled parsing function. But I still think that the defaultdict which holds classes containing all the relevant info is probably you’re best bet here (irrespective of how you manage to parse the data).