I have a table in pandas and I would like to transform the values in the column DE_ANALITO into columns whose values would be what is in the column DE_RESULTADO.
+----+----------------------------------+--------------------+----------------+
|    | ID_PACIENTE                      | DE_ANALITO         | DE_RESULTADO   |
|----+----------------------------------+--------------------+----------------|
|  0 | 3487791F44C34B421C932DC8616A8437 | Fosfatase Alcalina | 106            |
|  1 | 3487791F44C34B421C932DC8616A8437 | Gama-GT            | 33             |
|  2 | 3487791F44C34B421C932DC8616A8437 | ALT (TGP)          | 51             |
|  3 | 3487791F44C34B421C932DC8616A8437 | DHL                | 530            |
|  4 | 3487791F44C34B421C932DC8616A8437 | Proteína C-Reativa | 1,84           |
+----+----------------------------------+--------------------+----------------+
I try:
exames.pivot(index="ID_PACIENTE", columns="DE_ANALITO", values="DE_RESULTADO")
But the error returns:
ValueError: Index contains duplicate entries, cannot reshape
In the documentation of the pivot method, the pivot of a table with the same format as mine, with an index column with repeated values, is given as an example. I don't know what I'm doing wrong
