location_regains_mapper.py 494 B

1234567891011121314151617
  1. #!usr/bin/python
  2. import sys
  3. for line in sys.stdin :
  4. (loc,event_date,event_type,actor,lat,lon,src,
  5. fatalities)=line.strip().split("\t");
  6. (day,month,year)=event_date.split("/")
  7. if len(day)==1 :
  8. day="0"+day
  9. if len(month)==1 :
  10. month="0"+month
  11. if len(year)==2 :
  12. if int(year)>30 and int(year)<99:
  13. year="19"+year
  14. else:
  15. year="20"+year
  16. event_date=year+"-"+month+"-"+day
  17. print("\t".join([loc,event_date,event_type]))