Set table column size

How to set column size individually?

from PySide2 import QtCore, QtWidgets

class Project:
    def __init__(self, id, project_name): = id = project_name
        self.maya = ''
        self.description = ''

class TableModel(QtCore.QAbstractTableModel):
    def __init__(self, data, parent=None):
        QtCore.QAbstractTableModel.__init__(self, parent)
        self._data = data
        self.header = ['ID', 'Name']

    def headerData(self, col, orientation, role):
        if orientation == QtCore.Qt.Horizontal and role == QtCore.Qt.DisplayRole:
            return self.header[col]

    def rowCount(self, parent):
        return len(self._data)

    def columnCount(self, parent):
        return 2

    def data(self, index, role):
        if not index.isValid():

        row = index.row()
        column = index.column()

        if role == QtCore.Qt.DisplayRole:
            if column == 0:
                return self._data[row].id
            elif column == 1:
                return self._data[row].name

app = QtWidgets.QApplication([])

table = QtWidgets.QTableView()

data = [Project(0, 'Project_A'), Project(1, 'Project_B')]
table_model = TableModel(data)

Here ResizeToContent set size of both columns, I need to set this property for the first column only and scond to Stretch. I tryed:

table.horizontalHeader().setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeToContents)
table.horizontalHeader().setSectionResizeMode(1, QtWidgets.QHeaderView.Stretch)

But this code does not work, application crashes. Maybe there is a way to define size in pixel/percents?