0

I have a CSV file that I need to display on a Tkinter text box. I have everything I need inserted into the text box; however it is broken up similar to how it is displayed in the terminal after printing.

Here is what is being displayed in the text box...

                      Timezone (minutes)  Unix Timestamp (UTC)  \
Datetime (UTC)                                                   
2020-01-17T23:48:00Z                -300         1579304880000   
2020-01-17T23:49:00Z                -300         1579304940000   
2020-01-17T23:50:00Z                -300         1579305000000   
2020-01-17T23:51:00Z                -300         1579305060000   
2020-01-17T23:52:00Z                -300         1579305120000   

                      Acc magnitude avg   Eda avg   Temp avg  \
Datetime (UTC)                                                 
2020-01-17T23:48:00Z           1.063262  0.541921  30.155257   
2020-01-17T23:49:00Z           1.005967  0.539037  29.979900   
2020-01-17T23:50:00Z           1.045804  0.535254  29.713417   
2020-01-17T23:51:00Z           1.017389  0.532977  29.416833   
2020-01-17T23:52:00Z           1.030430  0.532688  29.275200   

                      Movement intensity  Steps count  Rest  On Wrist  
Datetime (UTC)                                                         
2020-01-17T23:48:00Z                   0            0     0      True  
2020-01-17T23:49:00Z                   0            0     0      True  
2020-01-17T23:50:00Z                   0            0     0      True  
2020-01-17T23:51:00Z                   0            0     0      True  
2020-01-17T23:52:00Z                   0            0     0      True  

Process finished with exit code 0

How do I make it display so that all the columns are right beside each other instead of breaking it up?

Here is my code...

pd.set_option('display.max_columns', None)
pd.set_option('display.max_rows', None)
df = pd.read_csv('Dataset/20200118/310/summary.csv', index_col=0)

def chart():
    scroll = Scrollbar(frame_right, orient="vertical")
    scroll.grid(row=0, column=1, rowspan=1, sticky="NS")
    scroll_h = Scrollbar(frame_right, orient="horizontal")
    scroll_h.grid(row=1, column=0, rowspan=1, sticky="EW")

    table = Text(frame_right, wrap="none")
    table.insert(END, str(df))
    table.configure(state=DISABLED, yscrollcommand=scroll.set, xscrollcommand=scroll_h.set)
    scroll.config(command=table.yview)
    scroll_h.config(command=table.xview)
    table.grid(row=0, column=0, rowspan=1, columnspan=1)

The end goal is to make the data display like a table, where I can scroll vertically and horizontally to see all of the data. Right now when I display all 1000 rows the data is too spread out to be able to understand, the user would have to scroll 1000 lines to see the next three columns.

deponovo
  • 1,114
  • 7
  • 23
Devin Bowen
  • 127
  • 1
  • 1
  • 13

0 Answers0