title: Python: Reading files and editing its content
body: <p>I got the following problem: I would like to read a data textfile which consists of two columns, year and temperature, and be able to calculate the minimum temperature etc. for each year. The whole file starts like this:</p>
  
  <pre><code>1995.0012 -1.34231 
  1995.3030 -3.52533
  1995.4030 -7.54334
  </code></pre>
  
  <p>and so on, until year 2013. I had the following idea:</p>
  
  <pre><code>f=open('munich_temperatures_average.txt', 'r')
  for line in f:
      line = line.strip()
      columns = line.split()
      year = float(columns[0])
      temperature=columns[1]
      if year-1995&lt;1 and year-1995&gt;0:
          print 1995, min(temperature)
  </code></pre>
  
  <p>With this I get only the year 1995 data which is what I want in a first step. In a second step I would like to calculate the minimal temperature of the whole dataset in year 1995. By using the script above, I however get the minimum temperature for every line in the datafile. I tried building a list and then appending the temperature but I run into trouble if I want to transform the year into an integer or the temperature into a float etc.</p>
  
  <p>I feel like I am missing the right idea how to calculate the minimum value of a set of values in a column (but not of the whole column).</p>
  
  <p>Any ideas how I could approach said problem? I am trying to learn Python but still at a beginners stage so if there is a way to do the whole thing without using "advanced" commands, I'd be ecstatic!</p>