WillH
WillH

Reputation: 303

Python Output to TKinter Entry has Float64

I am loading a CSV into a data frame, doing some calculations and then outputting the results to a grid of tkinter Entry boxes. This all works fine and the output is correct but it has a proceeding '0' and is followed by 'dtype:float64'. The data in the Entry looks like this (xxxx being the only data I want to display):

0  xxxxxx dtype:float64

screenshot of output tkinter window:

screengrab of output tkinter window

To put the calculated data into the Entry box, I am using the command:

BGO_Yin.insert(0,BGO_Y)

Can I remove the extraneous parts somehow, or reformat the output variable?

Upvotes: 0

Views: 93

Answers (1)

WillH
WillH

Reputation: 303

The above comment answers solved the problem with my Tkinter GUI. I have subsequently upgraded to a PyQt5 QT Desinger GUI, the final code to send the formatted text the text_box in that case is:

self.Q_BGO_Y.setText(str(BGO_Y.iloc[0]))
self.Q_BGO_Y.repaint() #repaint to overcome known bug where text is not initially visible.

Upvotes: 0

Related Questions