UnmeltProxyModel
Base classes
| Name | Children | Inherits |
|---|---|---|
FlatProxyModelprettyqt.itemmodels.proxies.flatproxymodel Base class for proxies which reshape a source table into another flat table. |
|
â‹” Inheritance diagram
graph TD
3482035875["itemmodels.UnmeltProxyModel"]
1752756326["itemmodels.FlatProxyModel"]
445963150["itemmodels.FlatProxyMixin"]
2751680898["builtins.object"]
1274898529["core.AbstractProxyModel"]
2431222121["core.AbstractProxyModelMixin"]
3882849576["core.AbstractItemModelMixin"]
3227531497["core.ObjectMixin"]
3989152870["QtCore.QAbstractProxyModel"]
1898060022["QtCore.QAbstractItemModel"]
3984060476["QtCore.QObject"]
37984305["Shiboken.Object"]
1752756326 --> 3482035875
445963150 --> 1752756326
2751680898 --> 445963150
1274898529 --> 1752756326
2431222121 --> 1274898529
3882849576 --> 2431222121
3227531497 --> 3882849576
2751680898 --> 3227531497
2751680898 --> 3882849576
2751680898 --> 2431222121
3989152870 --> 1274898529
1898060022 --> 3989152870
3984060476 --> 1898060022
37984305 --> 3984060476
2751680898 --> 37984305
🛈 DocStrings
Bases: FlatProxyModel
Proxy model to pivot a table from long format to wide format.
Reverses the MeltProxyModel operation.
app = widgets.app()
data = {
"ID": ["A", "A", "B", "B"] * 2,
"Variable": ["height", "weight"] * 4,
"Value": [5.5, 130, 6.0, 150, 5.7, 140, 5.9, 145],
}
model = gui.StandardItemModel.from_dict(data)
table = widgets.TableView()
table.set_model(model)
table.proxifier.unmelt(id_columns=[0], variable_column=1, value_column=2)
table.show()
Source code in prettyqt/itemmodels/proxies/unmeltproxymodel.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | |
__init__(id_columns: list[int], variable_column: int, value_column: int, **kwargs)
Initialize UnmeltProxyModel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
id_columns
|
list[int]
|
List of column indices that identify unique rows |
required |
variable_column
|
int
|
Column index containing variable names |
required |
value_column
|
int
|
Column index containing values |
required |
kwargs
|
Additional keyword arguments. |
{}
|
Source code in prettyqt/itemmodels/proxies/unmeltproxymodel.py
columnCount(parent: core.ModelIndex | None = None) -> int
Return number of columns in the model.
Source code in prettyqt/itemmodels/proxies/unmeltproxymodel.py
data(index: core.ModelIndex, role: constants.ItemDataRole = constants.DISPLAY_ROLE) -> Any
Return data for given index and role.
Source code in prettyqt/itemmodels/proxies/unmeltproxymodel.py
headerData(section: int, orientation: constants.Orientation, role: constants.ItemDataRole = constants.DISPLAY_ROLE) -> Any
Return header data for given section and orientation.
Source code in prettyqt/itemmodels/proxies/unmeltproxymodel.py
mapFromSource(source_index: core.ModelIndex) -> core.ModelIndex
Map source index to proxy index.
Source code in prettyqt/itemmodels/proxies/unmeltproxymodel.py
mapToSource(proxy_index: core.ModelIndex) -> core.ModelIndex
Map proxy index to source index.
Source code in prettyqt/itemmodels/proxies/unmeltproxymodel.py
rowCount(parent: core.ModelIndex | None = None) -> int
Return number of rows in the model.