'Why I meet a index error in panda pivot function?
I try to use pivot function to covert a csv file t
Here is my code and csv file https://drive.google.com/file/d/15afiPatjBwdinnqPwQIvcss5GvsfUzrK/view?usp=sharing
I read csv file as df3 pdframe,than I use pandas pivot function make User-ID as index colume is ISBN and save to df5 new pdframe but python show the error
df4 = df3.groupby(['User-ID', 'ISBN'])
print(df4.size())
df5=df3.pivot(index='User-ID', columns='ISBN', values='Book-Rating')
but python3 show index error as below
User-ID ISBN
10 1841721522 1
8477024456 1
100 0431111110 1
1000 8850200005 1
100001 0425182673 1
..
99997 0375506039 1
0385259956 1
0451202341 1
0771060548 1
99998 0140622144 1
Length: 1034728, dtype: int64
C:\Users\NEK\AppData\Roaming\Python\Python310\site-packages\pandas\core\reshape\reshape.py:130: RuntimeWarning: overflow encountered in long_scalars num_cells = num_rows * num_columns Exception "unhandled IndexError" index 1579266012 is out of bounds for axis 0 with size 1579249988 File: C:\Users\NEK\AppData\Roaming\Python\Python310\site-packages\pandas\core\reshape\reshape.py, Line: 189
Can any one knows what happen?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
