code: def timeSeries(self, tag = None, outputFile = None, giveYears = True, greatestFirst = True, limitTo = False, pandasMode = True):
          seriesDict = {}
          for R in self:
              try:
                  year = R['year']
              except KeyError:
                  continue
              if tag is None:
                  seriesDict[R] = {year : 1}
              else:
                  try:
                      val = R[tag]
                  except KeyError:
                      continue
                  if not isinstance(val, list):
                      val = [val]
                  for entry in val:
                      if limitTo and entry not in limitTo:
                          continue
                      if entry in seriesDict:
                          try:
                              seriesDict[entry][year] += 1
                          except KeyError:
                              seriesDict[entry][year] = 1
                      else:
                          seriesDict[entry] = {year : 1}
          seriesList = []
          for e, yd in seriesDict.items():
              seriesList += [(e, y) for y in yd.keys()]
          seriesList = sorted(seriesList, key = lambda x: x[1], reverse = greatestFirst)
          if outputFile is not None:
              with open(outputFile, 'w') as f:
                  writer = csv.writer(f, dialect = 'excel')
                  writer.writerow((str(tag), 'years'))
                  writer.writerows(((k,'|'.join((str(y) for y in v))) for k,v in seriesDict.items()))
          if pandasMode:
              panDict = {'entry' : [], 'count' : [], 'year' : []}
              for entry, year in seriesList:
                  panDict['entry'].append(entry)
                  panDict['year'].append(year)
                  panDict['count'].append(seriesDict[entry][year])
              return panDict
          elif giveYears:
              return seriesList
          else:
              return [e for e,c in seriesList]