j-andrews7 / kenpompy

A simple yet comprehensive web scraper for kenpom.com.
https://kenpompy.readthedocs.io/en/latest/?badge=latest
GNU General Public License v3.0
73 stars 21 forks source link

Error with Dataframe column mapping for get_playerstats() #5

Closed cjt243 closed 4 years ago

cjt243 commented 4 years ago

For 2P, 3P and FT metrics, the column mapping is 7 elements instead of 9.

image

And missing (2P for example): image

So the 2P% is fitting, but the column mapping isn't accounting for attempts and makes.

cjt243 commented 4 years ago

I added an additional elif to the get_playerstats() function that essentially cleans up the dataframe properly (albeit a bit hacky): ps_df.columns = ['Rank', 'Player', 'Team', metric.replace('%','M'), metric.replace('%','A'), metric, 'Ht', 'Wt', 'Yr']

j-andrews7 commented 4 years ago

Can you give me a reproducible call? I'll take a look at this sometime this week if I get a chance.

On Mon, Mar 9, 2020, 11:56 AM Cullin Tripp notifications@github.com wrote:

I added an additional elif to the get_playerstats() function that essentially cleans up the dataframe properly (albeit a bit hacky): ps_df.columns = ['Rank', 'Player', 'Team', metric.replace('%','M'), metric.replace('%','A'), metric, 'Ht', 'Wt', 'Yr']

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/j-andrews7/kenpompy/issues/5?email_source=notifications&email_token=ACOAQNGFQKFX7DAFHILQZVDRGUUVLA5CNFSM4LEM3642YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOICU7I#issuecomment-596650621, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACOAQNDY2GGR7D5C5RGXCYLRGUUVLANCNFSM4LEM364Q .

cjt243 commented 4 years ago

You should be able to reproduce this: df = kp.get_playerstats(browser,season=2020,metric='2P')

I get this Traceback (last error): ValueError: Length mismatch: Expected axis has 9 elements, new values have 7 elements

j-andrews7 commented 4 years ago

This is indeed an oversight for 2P%, 3P%, and FT% metrics. I will push a fix soon.

j-andrews7 commented 4 years ago

This is fixed in a new release, v0.2.1. Thanks for reporting.

cjt243 commented 4 years ago

No problem, glad to help! Love the package btw