16
Sto provando ad utilizzare il metodo pivot_table di un DataFrame panda;TypeError: pivot_table() ha ottenuto un argomento parola chiave inaspettato 'rows'
mean_ratings = data.pivot_table('rating', rows='title', cols='gender', aggfunc='mean')
Tuttavia, ricevo il seguente errore:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-55-cb4d494f2f39> in <module>()
----> 1 mean_ratings = data.pivot_table('rating', rows='title', cols='gender', aggfunc='mean')
TypeError: pivot_table() got an unexpected keyword argument 'rows'
Il comando precedente è stata presa dal libro 'Python for Data Analysis' da Wes McKinney (il creatore di panda)
In realtà non è una soluzione, solo la sintassi corretta per 'pivot_table' ... –
Suona come un insetto nel libro che ho copiato il comando da. Ho aggiornato la domanda per riflettere questo. –
No, non è un bug, queste sono solo le vecchie parole chiave che sono state deprecate per un po 'e ora rimosse. Da qui l'errore che hai ottenuto – joris