小编lea*_*ode的帖子

Scikit-learn:preprocessing.scale()vs preprocessing.StandardScalar()

我知道缩放意味着以均值为中心(均值= 0)并使单位方差(方差= 1).

但是,scikit-learn preprocessing.scale(x)preprocessing.StandardScalar()scikit-learn有什么区别?

python scale scikit-learn

8
推荐指数
1
解决办法
4134
查看次数

在 PyQt4 中调整 QTableView 的垂直标题的大小?

在此处输入图片说明

我需要减小第一列的大小(带有垂直标题的列)

如何在 PyQt4 中调整 QTableView 的垂直标题的大小?

我有非常大的标题和小的 GUI 块来显示此表,所以请帮助我!

我能够调整所有列的大小,但无法弄清楚调整垂直标题的大小?

我尝试了很多事情,例如:

self.tableView.setColumnWidth(0, 30)  // only able to change the data columns in table not headers

self.tableView.verticalHeader().setResizeMode(QHeaderView.Interactive)  //Able to change the height of headers but not width of them
Run Code Online (Sandbox Code Playgroud)

我想制作可由用户调整大小的标题,并且不依赖于项目的任何其他参数,如窗口大小、其他列的大小......

有人可以帮我弄这个吗?

python resize qtableview pyqt4 qheaderview

6
推荐指数
1
解决办法
4126
查看次数

更改QString或QLineEdit的颜色和字体

如何更改QLineEdit的颜色和字体?

这是我的代码:

self.lineEdit = QtGui.QLineEdit(widget)
self.lineEdit.setText("enter keywords here") #I want this to be in italics and in brown color
Run Code Online (Sandbox Code Playgroud)

文档中setText那一行说里面的文本是QString,如何更改它的字体和颜色?

python qstring pyqt4 qlineedit

5
推荐指数
1
解决办法
8069
查看次数

从 pyqt4 中的 QTableView 复制/粘贴多个项目?

我们可以使用 QTableView 从 QTableView 中选择多个项目(部分行和部分列)self.tableView.setSelectionMode(QAbstractItemView.ExtendedSelection),但是在选择一些行和列(部分和部分)后,如果我CTRL+C并将其粘贴到记事本中,它只会粘贴一项(来自 tableView 的一个值)?

我的代码:

tab_table_view = QtGui.QWidget()
self.Tab.insertTab(0, tab_table_view, self.File_Name)
self.tableView = QtGui.QTableView(tab_table_view)
self.tableView.setGeometry(QtCore.QRect(0, 0, 721, 571))
self.model = QtGui.QStandardItemModel(self)
self.model.setSortRole(QtCore.Qt.UserRole)
self.tableView.setModel(self.model)

    self.tableView.setSelectionMode(QAbstractItemView.ExtendedSelection) '''this helps for selecting multiple items but not able to copy and paste multiple values to a text/ excel (it only copies single value)'''
Run Code Online (Sandbox Code Playgroud)

我们如何复制和粘贴多个项目?

python copy-paste qtableview pyqt4 qabstractitemview

3
推荐指数
2
解决办法
5929
查看次数

在 PyQt4 中检查 QPushButton 的状态?

我想写一个if条件作为QPushButton. if如果按钮已启用,我想执行。那么,我如何检查按钮的状态。

代码:

self.pushButton = QtGui.QPushButton()
self.pushbutton.setEnabled(False)
Run Code Online (Sandbox Code Playgroud)
self.pushbutton.setEnabled(False) ##some where in the another class I have enabled it this line will not be executed all the time,so I want the check state.
Run Code Online (Sandbox Code Playgroud)
if self.pushbutton.checkstate() == Enabled:  ##??? How to write this condition?
    some code I want to execute
Run Code Online (Sandbox Code Playgroud)

python pyqt4 qpushbutton

3
推荐指数
1
解决办法
8961
查看次数

我是否需要在训练数据中缩放测试数据和因变量?

我是机器学习中缩放特征概念的新手,我读到当一个特征范围与其他特征相比非常高时,缩放将很有用。但是,如果我选择缩放训练数据,则:

  1. 我可以只缩放具有高范围的一项功能吗?
  2. 如果我缩放整个X火车数据,那么我还需要缩放y火车数据和整个测试数据吗?

python machine-learning scikit-learn

3
推荐指数
1
解决办法
4053
查看次数

如何复制 - 将QStandardItemModel创建的QTableView粘贴到文本/ excel文件?

如何将QTableView的多个项目/值复制并粘贴到text/excel文件?

我的代码:

tab_table_view = QtGui.QWidget()
self.Tab.insertTab(0, tab_table_view, self.File_Name)
self.tableView = QtGui.QTableView(tab_table_view)
self.tableView.setGeometry(QtCore.QRect(0, 0, 721, 571))
self.model = QtGui.QStandardItemModel(self)
self.tableView.setSelectionMode(QAbstractItemView.ExtendedSelection
Run Code Online (Sandbox Code Playgroud)

这一行self.tableView.setSelectionMode(QAbstractItemView.ExtendedSelection有助于在QTableView中选择多个项目,但是当我执行CTRL+ C粘贴它时,只粘贴选择的最后一项或值?

我已经看过该行,self.tableView.setEditTriggers(QAbstractItemView.AllEditTriggers)但是这个只适用于表中的单个项目而忽略了扩展选择.

请帮助我,这是我第二次发布这个问题.现在,我想知道它是否可能?请让我知道任何人!

pyqt qtableview pyqt4 qstandarditemmodel qabstractitemview

1
推荐指数
1
解决办法
1647
查看次数