{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"# NFL Player Contact Data HistPlot","metadata":{"papermill":{"duration":0.005899,"end_time":"2022-02-23T07:50:06.365145","exception":false,"start_time":"2022-02-23T07:50:06.359246","status":"completed"},"tags":[]}},{"cell_type":"code","source":"import numpy as np\nimport pandas as pd\nimport os\nimport matplotlib.pyplot as plt\nimport seaborn as sns\nfrom tqdm import tqdm","metadata":{"_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","papermill":{"duration":0.019986,"end_time":"2022-02-23T07:50:06.390861","exception":false,"start_time":"2022-02-23T07:50:06.370875","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-12-20T07:06:00.894149Z","iopub.execute_input":"2022-12-20T07:06:00.894511Z","iopub.status.idle":"2022-12-20T07:06:01.413092Z","shell.execute_reply.started":"2022-12-20T07:06:00.894480Z","shell.execute_reply":"2022-12-20T07:06:01.412128Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"paths=[]\nnames=[]\nfor dirname, _, filenames in os.walk('/kaggle/input/nfl-player-contact-detection'):\n    for filename in filenames:\n        if filename[-4:]!='.mp4':\n            paths+=[os.path.join(dirname, filename)]\n            names+=[filename[0:-4]]","metadata":{"papermill":{"duration":0.021495,"end_time":"2022-02-23T07:50:06.417749","exception":false,"start_time":"2022-02-23T07:50:06.396254","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-12-20T07:06:01.415159Z","iopub.execute_input":"2022-12-20T07:06:01.415449Z","iopub.status.idle":"2022-12-20T07:06:01.613814Z","shell.execute_reply.started":"2022-12-20T07:06:01.415422Z","shell.execute_reply":"2022-12-20T07:06:01.612967Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cols=[]\nfor i in range(len(paths)):\n    names[i]=pd.read_csv(paths[i])#,encoding='cp932'\n    cols+=[names[i].columns.tolist()]\n    print(paths[i].split('/')[-1][0:-4])\n    display(names[i])\n    print()","metadata":{"papermill":{"duration":0.762778,"end_time":"2022-02-23T07:50:07.185575","exception":false,"start_time":"2022-02-23T07:50:06.422797","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-12-20T07:06:01.615050Z","iopub.execute_input":"2022-12-20T07:06:01.616026Z","iopub.status.idle":"2022-12-20T07:06:20.506577Z","shell.execute_reply.started":"2022-12-20T07:06:01.615991Z","shell.execute_reply":"2022-12-20T07:06:20.505586Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"for i in range(len(paths)):\n    print(i,paths[i].split('/')[-1][0:-4])","metadata":{"execution":{"iopub.status.busy":"2022-12-20T07:06:20.508084Z","iopub.execute_input":"2022-12-20T07:06:20.508750Z","iopub.status.idle":"2022-12-20T07:06:20.514854Z","shell.execute_reply.started":"2022-12-20T07:06:20.508709Z","shell.execute_reply":"2022-12-20T07:06:20.513920Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# hist_plots except for sample_submission and train_labels","metadata":{"execution":{"iopub.status.busy":"2022-12-20T07:06:20.517667Z","iopub.execute_input":"2022-12-20T07:06:20.518258Z","iopub.status.idle":"2022-12-20T07:06:20.525037Z","shell.execute_reply.started":"2022-12-20T07:06:20.518221Z","shell.execute_reply":"2022-12-20T07:06:20.523800Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"for j in [2,0,4,3]:\n    train=names[j]\n    colsj=cols[j]\n    rs=len(colsj)%2\n    m=len(colsj)//2\n    if rs==1:\n        m=m+1\n    print(paths[j].split('/')[-1][0:-4])\n    fig, ax = plt.subplots(m,2,figsize=(15,m*4))\n    for i in tqdm(range(len(colsj))):\n        r=i//2\n        c=i%2\n        sns.histplot(train[colsj[i]], label=colsj[i], ax=ax[r,c], color='C1',bins=40)\n        ax[r,c].legend()\n        ax[r,c].grid()\n    plt.show()","metadata":{"papermill":{"duration":0.030243,"end_time":"2022-02-23T07:50:07.302384","exception":false,"start_time":"2022-02-23T07:50:07.272141","status":"completed"},"tags":[],"execution":{"iopub.status.busy":"2022-12-20T07:06:20.526285Z","iopub.status.idle":"2022-12-20T07:06:20.527029Z","shell.execute_reply.started":"2022-12-20T07:06:20.526775Z","shell.execute_reply":"2022-12-20T07:06:20.526799Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"for j in [5,6]:\n    train=names[j]\n    colsj=cols[j]\n    rs=len(colsj)%2\n    m=len(colsj)//2\n    if rs==1:\n        m=m+1\n    print(paths[j].split('/')[-1][0:-4])\n    fig, ax = plt.subplots(m,2,figsize=(15,m*4))\n    for i in tqdm(range(len(colsj))):\n        r=i//2\n        c=i%2\n        sns.histplot(train[colsj[i]], label=colsj[i], ax=ax[r,c], color='C1',bins=40)\n        ax[r,c].legend()\n        ax[r,c].grid()\n    plt.show()","metadata":{"execution":{"iopub.status.busy":"2022-12-20T07:06:20.528420Z","iopub.status.idle":"2022-12-20T07:06:20.529239Z","shell.execute_reply.started":"2022-12-20T07:06:20.528889Z","shell.execute_reply":"2022-12-20T07:06:20.528915Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}