Python data analysis-kobe Bryan Career data reading and analysis

Source: Internet
Author: User

1. Import data (CSV format) into Jupyter

Import Pandas as PD

Import Matplotlib.pyplot as Plt

Filename= ' Data.csv '

Raw=pd.read_csv filename

Print (Raw.shape)

Raw.head () #打印前几行

2. Remove null values for a column

Kobe=raw[pd.notnull (raw[' Shot_made_flag ')]

Print (Kobe.shape)

3. Drawing with Matplotlib

alpha=0.02# point transparency, the smaller the more transparent

Plt.figure (figsize= (10,10))

Plt.subplot (121) #一行两列, the first one

Plt.scatter (kobe.loc_x,kobe.loc_y,color= ' Blue ', Alpha=alpha) #散点图

Plt.title (' loc_x and Loc_y ')

Plt.subplot (122) #一行两列, the first one

Plt.scatter (kobe.loc_x,kobe.loc_y,color= ' green ', Alpha=alpha) #散点图

Plt.title (' Lat and lon ')

4. Print unique values

Print (Kobe.action_type.unique ())

Print (Kobe.combined_shot_type.unique ())

Print (Kobe.shot_type.unique ())

Print (Kobe.shot_type.value_counts ()) #相同值出现次数

5.

Python data analysis-kobe Bryan Career data reading and analysis

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.