title: transpose selected rows of a column to one row with python
body: <p>I have a file which contains values (one column) for each hour of the day (365 days in total). A part of the file is shown below:</p>
  <p><a href="https://i.stack.imgur.com/CjL8U.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CjL8U.png" alt="enter image description here" /></a></p>
  <p>How could I transpose the days (i.e. 24 hours) in one column so as to have finally a file with 365 rows and 24 columns.</p>
  <p>In a simple case of transpose I would do the following</p>
  <pre><code>import pandas as pd
  df = pd.read_csv(infile)
      df_transposed = df.T
      df_transposed.to_csv(outfile)
  </code></pre>
  <p>May I use a group for the selected hours and how?</p>