Hi,
i'm doing a program in QTpy5 and I want to remove the dot in the query
in python is easy here i cant make it work
here is my code:
def clicker(self):
df = pd.read_excel("book2.xlsx")
ser = self.textEdit.toPlainText()
df_val = df.query(f"id=={ser}")['Name']
df_val1 = df.query(f"id=={ser}")['Numero']
df_val3 = df.query(f"id=={ser}")['Reportado']
self.label.setText(df_val.values[0])
self.label_2.setText(str(df_val1.values[0]))
self.textEdit_2.setText(str(df_val1.values[0]))
code
thanks
you haven't supplied samples of 'work2.ui' or 'book2.xlsx', so can't run your code.
sorry i tought it will be easier on :
https://replit.com/@devilonline/test#main.py
thanks
from PyQt5.QtWidgets import QMainWindow, QApplication, QPushButton, QTextEdit, QLabel
from PyQt5 import uic
import sys
from openpyxl import load_workbook
from openpyxl import Workbook
import pandas as pd
class UI(QMainWindow):
def __init__(self):
super(UI, self).__init__()
uic.loadUi("work2.ui", self)
self.button = self.findChild(QPushButton, "pushButton")
self.label = self.findChild(QLabel, "label")
self.label_2 = self.findChild(QLabel, "label_2")
self.label_3 = self.findChild(QLabel, "label_3")
self.textEdit = self.findChild(QTextEdit, "textEdit")
self.textEdit_2 = self.findChild(QTextEdit, "textEdit_2")
self.button.clicked.connect(self.clicker)
self.show()
def clicker(self):
df = pd.read_excel("book2.xlsx")
ser = self.textEdit.toPlainText()
df_val = df.query(f"id=={ser}")['Name']
df_val1 = df.query(f"id=={ser}")['Numero']
df_val3 = df.query(f"id=={ser}")['Reportado']
self.label.setText(df_val.values[0])
self.label_2.setText(str(df_val1.values[0]))
self.textEdit_2.setText(str(df_val1.values[0]))
if (df_val3.values[0]) == "sim":
self.label_3.setText("Ver Processo")
else:
self.label_3.setText("")
app = QApplication(sys.argv)
UIWindow = UI()
app.exec_()
Output:
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>356</width>
<height>270</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QPushButton" name="pushButton">
<property name="geometry">
<rect>
<x>110</x>
<y>90</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>PushButton</string>
</property>
</widget>
<widget class="QTextEdit" name="textEdit">
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>61</width>
<height>31</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>130</x>
<y>20</y>
<width>191</width>
<height>31</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>130</x>
<y>50</y>
<width>91</width>
<height>31</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="text">
<string/>
</property>
<property name="indent">
<number>-2</number>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>230</x>
<y>50</y>
<width>91</width>
<height>31</height>
</rect>
</property>
<property name="font">
<font>
<family>Times New Roman</family>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">selection-color: rgb(255, 0, 0);</string>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QTextEdit" name="textEdit_2">
<property name="geometry">
<rect>
<x>100</x>
<y>150</y>
<width>81</width>
<height>21</height>
</rect>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>356</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources/>
<connections/>
</ui>
Where is the dot you wish to remove?