need help comparing data in a 2 CSVs! (python possibly but no idea how) OTRS/OCS - FREE GAMES!!

Associate
Joined
13 Sep 2010
Posts
2,093
Hi,

at work we have a need to merge 2 csv files, from two different asset management sytems, basically we want to be able to set an asset as 'in for repair' in one system (OTRS), and be able to import data from the other system (OCS), but maintain the 'in for repair' value (from a single column)

I'm really struggling to explain this, so apologies if that makes no sense!

(if anyone can help me achive what we want, there may be a free game in it for you leftover from my recent bundle purchases!)

Thanks
 
Soldato
Joined
1 Mar 2003
Posts
5,508
Location
Cotham, Bristol
Use a dict reader,

For example

Code:
import csv

fields = ["x", "y", "in_for_repair"]
otrsLineReader   = csv.DictReader(open('otrs.csv', 'rb'), delimiter=",",fieldnames=fields)
ocsLineReader   = csv.DictReader(open('ocs.csv', 'rb'), delimiter=",",fieldnames=fields)

rowsFromOTRS = [row for row in otrsLineReader]
rowsFromOCS = [row for row in ocsLineReader]

#compare first row from each file
if rowsFromOTRS[0]["in_for_repair"] == rowsFromOCS[0]["in_for_repair"]:
   #do something
 
Last edited:
Associate
OP
Joined
13 Sep 2010
Posts
2,093
Paul, thanks for the suggestion, but we just couldn't get our heads around python in time. My manager found a way of doing it using powershell instead!

I still appreciate you going to the effort to help, so if you would like 1 of the following games as a thankyou, please let me know via this thread, and I'll send via trust (or in some cases will have to gift through steam):

steam gift:
Portal
GRID
The Ship

Steam key:
Limbo
Mirror's Edge
 
Back
Top Bottom