quick logic question.
If I have a CSV file that has a dictionary value for each line (with columns being ["Location"], ["Movie Title"], ["Date"]), what's the best way for me to combined the Title and Date values of data rows with the same Location value?
snippet of data:
Location Movie Title Date
Edgebrook Park, Chicago A League of Their Own 7-Jun
Edgebrook Park, Chicago It's a Mad, Mad, Mad, Mad World 9-Jun
For every row that has the same location (^as in this example), i'd like to make an output like this so that there are no duplicate locations.
Edgebrook Park, Chicago A League of Their Own 7-Jun It's a Mad, Mad, Mad, Mad World 9-Jun
What would be the best way to go about this?
UPDATE: I've had to change the data a little bit, so now my columns are looking like:
Location,MovieDate,Formatted_Address,Lat,Lng
"Edgebrook Park, Chicago ",Jun-7 A League of Their Own,"Edgebrook Park, 6525 North Hiawatha Avenue, Chicago, IL 60646, USA",41.9998876,-87.7627672
"Gage Park, Chicago ","Jun-9 It's a Mad, Mad, Mad, Mad World","Gage Park, Chicago, IL, USA",41.7954363,-87.6962257
"Jefferson Memorial Park, Chicago ",Jun-12 Monsters University ,"Jefferson Memorial Park, 4822 North Long Avenue, Chicago, IL 60630, USA",41.76083920000001,-87.6294353
"Commercial Club Playground, Chicago ",Jun-12 Despicable Me 2,"Chicago, IL, USA",41.8781136,-87.6297982
and so on. I'm seeing a lot of OrderedDict
or defaultdict
suggestions around here, but what's the best way to extend or append just the 'MovieDates'
column now, instead of the entire rest of the row as the value to the 'Location'
column key?