I want to plot a graph but I get ValueError: x must be a label or position
Calc_height distribution avg_overall_rating avg_potential avg_weight
0 165.0 74 67.365543 73.327754 139.459459
1 168.0 118 67.500518 73.124182 44.127119
2 170.0 403 67.726903 73.379056 147.799007
3 173.0 530 66.980272 72.848746 152.824528
4 175.0 1188 66.805204 72.258774 156.111953
5 178.0 1489 66.367212 71.943339 160.665547
6 180.0 1388 66.419053 71.846394 165.261527
7 183.0 1954 66.634380 71.754555 170.167861
8 185.0 1278 66.928964 71.833475 174.636933
9 188.0 1305 67.094253 72.151949 179.278161
10 191.0 652 66.997649 71.846159 184.791411
11 193.0 470 67.485141 72.459225 188.795745
12 195.0 211 67.425619 72.615373 196.464455
While trying to plot
players_height.plot(x=['Calc_height'],y=['avg_overall_rating'],figsize=(12,5),title='Potential vs Height')
CodePudding user response:
The arguments x
and y
take labels (strings) as input.
players_height.plot(x='Calc_height', y='avg_overall_rating', figsize=(12,5), title='Potential vs Height')