1

My df output looks something like this:

   'Datetime'             'Date'      'Time'
1   2017-02-24 12:24:11   2017-02-24    12:24:11
2   2017-03-11 12:13:01   2017-03-11    12:13:01

Is it possible to move the 'Time' column so that all three columns are side by side? What could be the reason that the 'Time' column is shown beneath the other two columns?

(Could it have anything to do with the way datetime.date() or datetime.time() extracts data? Or perhaps the \ character has to be removed?)

Gustav Rasmussen
  • 3,720
  • 4
  • 23
  • 53
  • 1
    Can you report you input in a more comprehensive way. Try typing 4 spaces before you put your input, or put it inside two `grave accent` or `backquote` https://en.wikipedia.org/wiki/Grave_accent. Also, show us clearly what the `output` should look like. – everestial007 Mar 15 '17 at 00:20
  • 1
    Also, upvote the answer it it helped you. Did you also approve the edits I made to your question? Thanks, – everestial007 Mar 15 '17 at 01:15

1 Answers1

1

Actually, there is no problem with your output. I think you are using the print statement and you can see that \ separating the datetime and date from time. This just a way pandas reports your output to fit on the screen. Actually all the column headers are on the same line.

Also, pandas only displays select number of rows/columns in the print output or console. If you need to adjust them you can follow this answer: Python pandas, how to widen output display to see more columns?

Community
  • 1
  • 1
everestial007
  • 6,665
  • 7
  • 32
  • 72