News for hackers. Stuff that matters.
Re:Analyzing Your Browser History Using Python and Pandas by rahiel on Monday November 13, 2017 @06:07AM (#15685639)
These two loops:

  raw_data = [line.split('|', 1) for line in [x.strip() for x in content]]
can be simplified to a single loop:

  raw_data = [line.strip().split('|', 1) for line in content]
Using str.replace here is also non-idiomatic:

  plt.title('Top $n Sites Visited'.replace('$n', str(topN)))
How about using str.format instead:

  plt.title('Top {n} Sites Visited'.format(n=topN))
Re:Analyzing Your Browser History Using Python and Pandas by hultner on Monday November 13, 2017 @07:03AM (#15685867)
You could even use the new format strings from Python3.6.

  f"Top {topN} Sites Visited"
Re:Analyzing Your Browser History Using Python and Pandas by applecrazy on Monday November 13, 2017 @09:43AM (#15686801)
thanks! The code in my post is mainly more of a POC than anything else, but in my next post I’ll try to be more Pythonic.