{"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":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\nimport matplotlib.pyplot as plt\nimport seaborn as sns\nimport plotly.express as px\nimport plotly.graph_objs as go\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2021-06-10T20:25:15.441244Z","iopub.execute_input":"2021-06-10T20:25:15.441624Z","iopub.status.idle":"2021-06-10T20:25:17.730277Z","shell.execute_reply.started":"2021-06-10T20:25:15.441587Z","shell.execute_reply":"2021-06-10T20:25:17.729055Z"},"_kg_hide-input":true,"_kg_hide-output":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#<font color=\"red\">Baseball Fan's Engagement</font>","metadata":{}},{"cell_type":"markdown","source":"![](https://pbs.twimg.com/media/EuXQpOtWYAEWBZc.jpg:large)twitter.com","metadata":{}},{"cell_type":"markdown","source":"#<font color=\"red\">Glossary of Baseball Jargon</font>\n\n<font color=\"red\">What is October called in baseball?</font>\n\n\"Fall Classic. The World Series -- the championship series of Major League Baseball, in which the champion of the American League faces off against the champion of the National League. Typically, this series takes place in October, so playing in October is the goal of any major league team.\"\n\n<font color=\"red\">What does S mean in baseball batting?</font>  SAVE\n\n\"In baseball statistics, save (abbreviated SV, or sometimes, S) is the successful maintenance of a lead by a relief pitcher, usually the closer, until the end of the game. ... He comes into the game with the potential tying run being either on base, at bat, or on deck.\"\n\n<font color=\"red\">What does F mean in baseball?</font> Foul Tip\n\n\"A batted ball that is hit sharply and directly from the bat to the catcher's mitt and legally caught by the catcher. It is not a foul tip, as most announcers and journalists mistakenly use the term, if the ball is not caught by the catcher. In this case, it is simply a foul ball.\"\n\n<font color=\"red\">What does R mean in baseball?</font> RUN\n\nRun (R) Runs Batted In (RBI)\n\n<font color=\"red\">Why do they use the letter K for a strikeout?</font>\n\n\"A strikeout is a Statistic recorded for both pitchers and batters, and is denoted by K.\"\n\nK is the prominent letter of the word \"strike,\" which was used more frequently than strikeout. Some scorers use a forward K for a swinging strikeout, a backward K for a batter caught looking.\"\n\nhttps://en.wikipedia.org/wiki/","metadata":{}},{"cell_type":"code","source":"import holoviews as hv\nfrom holoviews import opts\nhv.extension('bokeh')","metadata":{"execution":{"iopub.status.busy":"2021-06-10T19:02:21.840256Z","iopub.execute_input":"2021-06-10T19:02:21.840674Z","iopub.status.idle":"2021-06-10T19:02:23.469896Z","shell.execute_reply.started":"2021-06-10T19:02:21.840635Z","shell.execute_reply":"2021-06-10T19:02:23.468891Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df = pd.read_csv('../input/mlb-player-digital-engagement-forecasting/awards.csv', encoding='ISO-8859-2')\ndf.tail().style.set_properties(**{'background-color':'#0000FF',\n                                     'color': 'white'})","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2021-06-10T20:31:05.027223Z","iopub.execute_input":"2021-06-10T20:31:05.027598Z","iopub.status.idle":"2021-06-10T20:31:05.062283Z","shell.execute_reply.started":"2021-06-10T20:31:05.027554Z","shell.execute_reply":"2021-06-10T20:31:05.061407Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<center style=\"font-family:verdana;\"><h1 style=\"font-size:200%; padding: 20px; background: #001f3f;\"><i><b style=\"color:red;\">Awards</b></i></h1></center>\n\n<font color=\"red\">MVP Awards ( Most Valuable Player Award):</font> American League;; National League\n\n<font color=\"red\">Cy Young Awards (Best pitchers in Major League Baseball):</font> American League;; National League\nIn honor of Hall of Fame pitcher Cy Young, who died in 1955.\n\n<font color=\"red\">Rookie of the Year Awards:</font> American League;; National League \n\n<font color=\"red\">Manager of the Year Awards:</font> American League;; National League\n\n<font color=\"red\">MLB Awards</font>\n\n<font color=\"red\">Clemente Award</font> Recognizes those who best represent the game through positive contributions on and off the field, including sportsmanship and community involvement.\n\n<font color=\"red\">Aaron Awards</font> American League;; National League\n\n<font color=\"red\">Defensive Awards</font> Defensive Player of the Year\n\n<font color=\"red\">Relievers of the Year</font> Americam League;; National League\n\n<font color=\"red\">Silver Slugger Awards</font>\n\n<font color=\"red\"></font>\n\n<font color=\"red\">Gold Glove Awards</font>\n\n<font color=\"red\">Postseason Awards</font> WS MVP;; ALCS MVP;; NLCS MVP\n\n<font color=\"red\">Players Choice Awards</font> Player of the Year; Man of the Year; Always Game Award.\n\n<font color=\"red\">Comeback Player Awards</font> American League;; National League\n\n<font color=\"red\">Outstanding DH Award</font> Outstanding Designated Hitter Award.\n\nhttps://www.mlb.com/awards/2017","metadata":{}},{"cell_type":"markdown","source":"#<font color=\"red\">American League Most Valuable Player Award</font> \n\n\n![](https://www.theplayoffs.com.br/wp-content/uploads/2019/11/Trout-MVP-Twitter.jpg)theplayoffs.com.br","metadata":{}},{"cell_type":"code","source":"AlMvp= df[(df['awardName']=='AL MVP')].reset_index(drop=True)\nAlMvp.head()","metadata":{"execution":{"iopub.status.busy":"2021-06-10T18:56:39.735149Z","iopub.execute_input":"2021-06-10T18:56:39.735609Z","iopub.status.idle":"2021-06-10T18:56:39.754271Z","shell.execute_reply.started":"2021-06-10T18:56:39.73557Z","shell.execute_reply":"2021-06-10T18:56:39.75357Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#<font color=\"#DC143C\">October. Finally. We've never done it like this before.</font>","metadata":{}},{"cell_type":"markdown","source":"<iframe width=\"642\" height=\"361\" src=\"https://www.youtube.com/embed/MpczNpVk0k4\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>","metadata":{}},{"cell_type":"markdown","source":"https://www.youtube.com/watch?v=MpczNpVk0k4","metadata":{}},{"cell_type":"markdown","source":"#<font color=\"red\">We've never done it like this before:  October: The Remix (Postseason 2020)</font>\n\n<font color=\"#0000FF\">October. Finally. We've never done it like this before.</font>\n\n#<font color=\"#0000FF\">This  is October. Remix. This year we invited a few extra friends.</font>\n\n#<font color=\"#0000FF\">That means anything can happen. That's right. Anything.</font>\n\n#<font color=\"#0000FF\">These Kagglers are different. Watch the Comp. They are young, loud and hungry .</font>\n\n#<font color=\"#0000FF\">Same Comp. Whole new attitude.</font>\n\n#<font color=\"#0000FF\">And if you don't know. Now you know.</font>\n\n#<font color=\"#0000FF\">But one thing remains the same. This LB ain't gone lift itself.</font>\n\n<font color=\"#0000FF\">Ohhhhh Shiiiiii its ma boys</font>\n\n<font color=\"#0000FF\">Mic Drop.</font>\n\n#<font color=\"#0000FF\">Music: \"Mic Drop\" - BTS + Steve Aoki.</font>\n\nhttps://www.youtube.com/watch?v=MpczNpVk0k4","metadata":{}},{"cell_type":"code","source":"#word cloud\nfrom wordcloud import WordCloud, ImageColorGenerator\ntext = \" \".join(str(each) for each in AlMvp.playerName)\n# Create and generate a word cloud image:\nwordcloud = WordCloud(max_words=200,colormap='RdBu', background_color=\"Blue\").generate(text)\nplt.figure(figsize=(10,6))\nplt.figure(figsize=(15,10))\n# Display the generated image:\nplt.imshow(wordcloud, interpolation='Bilinear')\nplt.axis(\"off\")\nplt.figure(1,figsize=(12, 12))\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2021-06-10T20:29:37.613311Z","iopub.execute_input":"2021-06-10T20:29:37.613669Z","iopub.status.idle":"2021-06-10T20:29:37.874847Z","shell.execute_reply.started":"2021-06-10T20:29:37.613636Z","shell.execute_reply":"2021-06-10T20:29:37.873801Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#Red Sox Rookie of the Year","metadata":{}},{"cell_type":"code","source":"RedSox_rookie= df[(df['awardName']=='Red Sox Rookie of the Year')].reset_index(drop=True)\nRedSox_rookie.head()","metadata":{"execution":{"iopub.status.busy":"2021-06-10T18:57:33.983637Z","iopub.execute_input":"2021-06-10T18:57:33.984203Z","iopub.status.idle":"2021-06-10T18:57:33.999166Z","shell.execute_reply.started":"2021-06-10T18:57:33.984156Z","shell.execute_reply":"2021-06-10T18:57:33.998103Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"![](https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQ5-rrA84s5IdVlxHPYG0TL3rhAzjb8NGhDnw&usqp=CAU)americanas.com.br","metadata":{}},{"cell_type":"code","source":"df1 = pd.read_csv('../input/mlb-player-digital-engagement-forecasting/players.csv', encoding='ISO-8859-2')\ndf1.tail().style.set_properties(**{'background-color':'red',\n                                     'color': 'white'})","metadata":{"execution":{"iopub.status.busy":"2021-06-10T20:34:48.447987Z","iopub.execute_input":"2021-06-10T20:34:48.44838Z","iopub.status.idle":"2021-06-10T20:34:48.483874Z","shell.execute_reply.started":"2021-06-10T20:34:48.448344Z","shell.execute_reply":"2021-06-10T20:34:48.483148Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<center style=\"font-family:verdana;\"><h1 style=\"font-size:200%; padding: 20px; background: #001f3f;\"><i><b style=\"color:white;\">Baseball Positions</b></i></h1></center>\n\n<font color=\"red\">BASEBALL POSITIONS: BODY TYPE, SKILLS, NUMBERS AND MORE EXPLAINED</font>\n\nBy Dan Blewett / Baseball\n\n\"What do the baseball position numbers mean? They are used in scoring the game, and so each position is designated with a 1-9 number. They go in order, starting with the pitcher as #1, however the shortstop is out of order–he should be #5 if following the pattern, but instead is #6.\"\n\n\"This was because originally, the shortstop was the fourth outfielder. Later, the shortstop was moved permanently to the infield but his number stuck at #6. It’s important to understand the positional numbers so that a proper scorebook can be kept and players understand the lineup and dugout card.\"\n\n<font color=\"red\">Pitchers (Position #1 on the field chart)</font>\n\n\"Pitchers have a LOT of influence on the outcome of a game. Pitchers have the #1 designation in the baseball scorebook, and they’re in control of the ball and the speed of the game. The following are some of the skills a pitcher needs: Strong arm, Mentally tough, Able to handle high-pressure situations, High dexterity and “feel” for throwing a baseball, Good body control for repeatability of mechanics, Strong focus and baseball intelligence.\nVery competitive.\"\n\n<font color=\"red\">Catcher (Position #2 on the field chart)</font>\n\n\"Catchers have an extremely demanding role on the team – both physically and mentally. Because the catcher must control and corral the pitcher, he has to be physically and mentally quick. Foul tips and long days squatting and blocking in the heat make for very long, draining days.\"\n\n<font color=\"red\">First Baseman (Position #3 on the field chart)</font>\n\n\"First baseman are the biggest power hitters on a team, and they are typically very big and relatively slow because of this. First baseman can often “hide” at first because they don’t often have to make long throws or move around too much. But, that doesn’t mean first base is not a difficult position – it’s easy to play an average first base, but it’s NOT easy to be great at it.Good reflexes and instincts are important, as line drives scream to first base.\"\n\n<font color=\"red\">Second Baseman (Position #4 on the field chart)</font>\n\n\"Second baseman are typically great defensive players with the worst bat on the team. Though there are some great-hitting second baseman, it’s typically a less offensive player who excels at 2nd. Dustin Pedroia was an amazing player and a great example.\"\n\n\"Very agile and quick. Great IQ for the game. Excellent glove and defensive skills\nNeeds an adequate arm, but it doesn’t need to be a cannon. Should be fast and a skilled contact hitter. Typically a “spark plug” type player who gets on base and makes things happen on the basepaths.\"\n\n<font color=\"red\">Shortstop (Position #6 on the field chart)</font>\n\n\"Andrelton Simmons is one of the best defensive shortstops ever, and shows off the athleticism and skill needed to play the position at the highest level.\"Shortstops are usually the best athletes on the field at all levels of baseball.\"\n\n\"Must have excellent glove skills. Excellent range and agility. Excellent arm strength\nExcellent field vision and understanding of where to go and other players’ movement.\nHitting skills are secondary to defensive ability, however at the MLB level there is a growing importance on being threat at the plate – it’s not enough any more to hit .250 as an MLB shortstop. Must be mentally tough and have strong leadership skills.\"\n\n<font color=\"red\">Third Baseman (Position #5 on the field chart)</font>\n\n\"Third baseman have a similar skillset to shortstops, but they’re typically bigger, stronger and more capable of hitting for power. Nolan Arenado is a great example of a third baseman who is a threat at the plate and yet also an excellent defender.\"\n\n\"VERY strong arm to make long throws across the diamond. Excellent reflexes and is NOT afraid of the ball (they call it the hot corner for a reason). Great defender, but lacks the range of a shortstop typically because of bigger physical size. One of the top power-hitters on the team, typically. Many high school shortstops who don’t have quite the defensive skills to play SS in college move to third base and pack on some extra muscle.\"\n\n<font color=\"red\">Left Fielder (Position #7 on the field chart)</font>\n\"\n\"Left fielders typically have an OK arm with a decent glove and a solid bat. Because more throws from left field aren’t THAT long, they don’t need to have a cannon for an arm.\"\n\n\"Left fielders need to play excellent outfield defense and thus must be fast and have a great glove.\"\n\n<font color=\"red\">Center Fielder (Position #8 on the field chart)</font>\n\n\"Mike Trout is perhaps a stronger hitter than most center fielders (he’s a stronger hitter than everyone, but that’s another story…), but he’s still a great example of what a center fielder should be.\"\n\n\"Must be an excellent fielder – the best defensive outfielder on the team. Must be exceptionally fast. Must get great reads and jumps on fly balls. Arm must be strong\nMust be a solid hitter at the plate and a great base runner to utilize speed.\"\n\n<font color=\"red\">Right Fielder (Position #9 on the field chart)</font>\n\n\"Right fielders are most commonly known for having rocket launcher arms.\"\n\n\"At youth levels, the right fielder is one of the lesser players on the team because fewer fly balls are hit that way. At college and pro levels, the right fielder has one of the strongest arms on the team because of the long throw to third base Must hit for power\nMust be an excellent fielder but does not have to be as fast or as amazing in the outfield as the center fielder.\" \n\n<font color=\"red\">Other Positions: DH + Roles of Pinch Runner, Pinch Hitter</font>\n\n\"What is the DH in baseball? The Designated Hitter is a player who only hits, and this position exists only in the American League. The DH hits in place of the pitcher, who does not bat in the American League.\"\n\n\"Pinch Runners enter the game to run the bases in place of another player, but this is not really a position – more just a role. Same goes for pinch hitters, who replace a hitter already in the game to bat for them.\"\n\nhttps://danblewett.com/baseball-positions-fielders-body-type/","metadata":{}},{"cell_type":"markdown","source":"![](https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQipeeT74I4tBauKdH6v5a63HGEtpmLwePnQw&usqp=CAU)slideshare.net","metadata":{}},{"cell_type":"code","source":"#Code by Kohei-mu https://www.kaggle.com/koheimuramatsu/industrial-accident-causal-analysis/notebook\n\nposition_cnt = np.round(df1['primaryPositionName'].value_counts(normalize=True) * 100)\nhv.Bars(position_cnt).opts(title=\"Primary Position Name Count\", color=\"red\", xlabel=\"primaryPositionName\", ylabel=\"Percentage\", yformatter='%d%%')\\\n                .opts(opts.Bars(width=500, height=300,tools=['hover'],show_grid=True)).opts(xrotation=45)","metadata":{"execution":{"iopub.status.busy":"2021-06-10T19:06:10.231462Z","iopub.execute_input":"2021-06-10T19:06:10.231808Z","iopub.status.idle":"2021-06-10T19:06:10.318339Z","shell.execute_reply.started":"2021-06-10T19:06:10.231779Z","shell.execute_reply":"2021-06-10T19:06:10.317331Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<center style=\"font-family:verdana;\"><h1 style=\"font-size:200%; padding: 20px; background: #001f3f;\"><i><b style=\"color:white;\">Home Run (HR)</b></i></h1></center>\n\n\"A home run occurs when a batter hits a fair ball and scores on the play without being put out or without the benefit of an error.\"\n\n\"In almost every instance of a home run, a batter hits the ball in the air over the outfield fence in fair territory. In that situation, the batter is awarded all four bases, and any runners on base score as well. The batter can circle the bases at his leisure, as there is no threat of him being thrown out. (This also occurs when the ball hits the foul pole in left or right field, or when the ball hits an opposing defender on the fly and bounces directly over the wall in fair ground.)\"\n\n\"There are also instances of \"inside-the-park home runs.\" These occur when the batter hits the ball in play (not over the wall) and touches all four bases without being thrown out. These are extremely rare and typically only occur with a very fast runner at the plate and some sort of misplay by an outfielder that doesn't qualify as an error.\"\n\n\"The term \"home run\" comes from the basic act of a batter circling all the bases successfully. In the early days of the home run, running was typically a necessity as players weren't very powerful and outfields were much bigger, leading to a greater number of inside-the-park home runs. Now, however, most home runs feature players trotting around the bases after hitting the ball over the fence.\"\n\nhttps://www.mlb.com/glossary/standard-stats/home-run","metadata":{}},{"cell_type":"code","source":"#Code by Kohei-mu https://www.kaggle.com/koheimuramatsu/industrial-accident-causal-analysis/notebook\n\nfuture_cnt = np.round(df1['playerForTestSetAndFuturePreds'].value_counts(normalize=True) * 100)\nhv.Bars(future_cnt).opts(title=\"Player For Test Set And Future Preds\", color=\"red\", xlabel=\"playerForTestSetAndFuturePreds\", ylabel=\"Percentage\", yformatter='%d%%')\\\n                .opts(opts.Bars(width=500, height=300,tools=['hover'],show_grid=True))","metadata":{"execution":{"iopub.status.busy":"2021-06-10T19:52:00.382895Z","iopub.execute_input":"2021-06-10T19:52:00.383219Z","iopub.status.idle":"2021-06-10T19:52:00.459467Z","shell.execute_reply.started":"2021-06-10T19:52:00.383192Z","shell.execute_reply":"2021-06-10T19:52:00.458431Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#word cloud\nfrom wordcloud import WordCloud, ImageColorGenerator\ntext = \" \".join(str(each) for each in df1.primaryPositionName)\n# Create and generate a word cloud image:\nwordcloud = WordCloud(max_words=200,colormap='RdBu', background_color=\"Blue\").generate(text)\nplt.figure(figsize=(10,6))\nplt.figure(figsize=(15,10))\n# Display the generated image:\nplt.imshow(wordcloud, interpolation='Bilinear')\nplt.axis(\"off\")\nplt.figure(1,figsize=(12, 12))\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2021-06-10T20:26:04.50442Z","iopub.execute_input":"2021-06-10T20:26:04.504784Z","iopub.status.idle":"2021-06-10T20:26:04.732802Z","shell.execute_reply.started":"2021-06-10T20:26:04.504751Z","shell.execute_reply":"2021-06-10T20:26:04.731802Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df2 = pd.read_csv('../input/mlb-player-digital-engagement-forecasting/teams.csv', encoding='ISO-8859-2')\ndf2.tail().style.set_properties(**{'background-color':'#00008B',\n                                     'color': 'white'})","metadata":{"execution":{"iopub.status.busy":"2021-06-10T20:37:29.837737Z","iopub.execute_input":"2021-06-10T20:37:29.83829Z","iopub.status.idle":"2021-06-10T20:37:29.871509Z","shell.execute_reply.started":"2021-06-10T20:37:29.838227Z","shell.execute_reply":"2021-06-10T20:37:29.870757Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<center style=\"font-family:verdana;\"><h1 style=\"font-size:200%; padding: 20px; background: #001f3f;\"><i><b style=\"color:red;\">Baseball Divisions</b></i></h1></center>\n\n\n<font color=\"red\">American League East, Central and West</font>\n\nAmerican League East: Tampa Bay, Boston, N.Y.Yankees, Toronto, Baltimore\n\nAmerican League Central: Chi White Sox, Cleveland, Kansas City, Detroit, Minnesota\n\nAmerican League West: Oakland, Houston, Seattle, LA Angels, Texas. \n\n<font color=\"red\">National League East, Central and West</font>\n\nNational League East: NY Mets, Atlanta, Philadelphia, Washington, Miami\n\nNational League Central: Chi Cubs, Milwaukee, St.Louis, Cincinatti, Pittisburgh\n\nnational League West: San Francisco, LA Dodgers, San Diego, Colorado, Arizona\n\nhttps://www.mlb.com/standings","metadata":{}},{"cell_type":"code","source":"#Code by Kohei-mu https://www.kaggle.com/koheimuramatsu/industrial-accident-causal-analysis/notebook\n\ndivision_cnt = np.round(df2['divisionName'].value_counts(normalize=True) * 100)\nhv.Bars(division_cnt).opts(title=\"Division Name\", color=\"blue\", xlabel=\"divisionName\", ylabel=\"Percentage\", yformatter='%d%%')\\\n                .opts(opts.Bars(width=500, height=300,tools=['hover'],show_grid=True)).opts(xrotation=45)","metadata":{"execution":{"iopub.status.busy":"2021-06-10T19:57:32.778474Z","iopub.execute_input":"2021-06-10T19:57:32.779002Z","iopub.status.idle":"2021-06-10T19:57:32.855468Z","shell.execute_reply.started":"2021-06-10T19:57:32.778961Z","shell.execute_reply":"2021-06-10T19:57:32.85463Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"![](https://pbs.twimg.com/media/EbYHtmSU8AATCTa.jpg)itwperformancepolymers.com","metadata":{}},{"cell_type":"code","source":"#Code by Kohei-mu https://www.kaggle.com/koheimuramatsu/industrial-accident-causal-analysis/notebook\n\nleague_cnt = np.round(df2['leagueName'].value_counts(normalize=True) * 100)\nhv.Bars(league_cnt).opts(title=\"League Name\", color=\"blue\", xlabel=\"leagueName\", ylabel=\"Percentage\", yformatter='%d%%')\\\n                .opts(opts.Bars(width=500, height=300,tools=['hover'],show_grid=True))","metadata":{"execution":{"iopub.status.busy":"2021-06-10T19:57:02.226267Z","iopub.execute_input":"2021-06-10T19:57:02.22695Z","iopub.status.idle":"2021-06-10T19:57:02.308666Z","shell.execute_reply.started":"2021-06-10T19:57:02.226903Z","shell.execute_reply":"2021-06-10T19:57:02.307664Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df3 = pd.read_csv('../input/mlb-player-digital-engagement-forecasting/seasons.csv', encoding='ISO-8859-2')\ndf3.tail().style.set_properties(**{'background-color':'#DC143C',\n                                     'color': 'white'})","metadata":{"execution":{"iopub.status.busy":"2021-06-10T20:40:27.966929Z","iopub.execute_input":"2021-06-10T20:40:27.967495Z","iopub.status.idle":"2021-06-10T20:40:27.997265Z","shell.execute_reply.started":"2021-06-10T20:40:27.967453Z","shell.execute_reply":"2021-06-10T20:40:27.996383Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"<center style=\"font-family:verdana;\"><h1 style=\"font-size:200%; padding: 20px; background: #001f3f;\"><i><b style=\"color:red;\">MLB playoffs: 2021 posteason picture, format and schedule</b></i></h1></center>\n\nAuthor: Matt Johnson\n\n\"The 2021 season is underway and we’re starting to get a picture of how the MLB playoffs will look in October, with several teams emerging as World Series contenders.\"\n\n\"Throughout the season, we’ll have updates on where things stand in the postseason race for both American League and National League teams. We’ll also provide overviews for postseason matchups, which will continue to change as the 2021 season unfolds. Let’s dive into the latest playoff picture in June.\"With Major League Baseball shifting back to a 10-team format, the postseason will kick off on Tuesday, Oct. 5. It comes just two days after the 2021 MLB regular season wraps up.\n\n<font color=\"red\">When are the MLB playoffs?</font>\n\nWith Major League Baseball shifting back to a 10-team format, the postseason will kick off on Tuesday, Oct. 5. It comes just two days after the 2021 MLB regular season wraps up.\n\nNational League and American League wild-card games: Oct. 5-6\n\nAmerican League and National League Division Series: Oct. 7-14\n\nNL and AL Championship Series: Oct. 15-24\n\n2021 World Series: Oct. 26- Nov. 3\n\nhttps://sportsnaut.com/mlb-playoffs-schedule-bracket-dates/","metadata":{}},{"cell_type":"code","source":"fig = px.line(df3, x=\"seasonStartDate\", y=\"seasonId\", color_discrete_sequence=['#2B3A67'], \n              title=\"Seasons Start Dates\")\nfig.show()","metadata":{"execution":{"iopub.status.busy":"2021-06-10T20:52:39.309962Z","iopub.execute_input":"2021-06-10T20:52:39.310309Z","iopub.status.idle":"2021-06-10T20:52:39.365584Z","shell.execute_reply.started":"2021-06-10T20:52:39.310279Z","shell.execute_reply":"2021-06-10T20:52:39.36481Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#word cloud\nfrom wordcloud import WordCloud, ImageColorGenerator\ntext = \" \".join(str(each) for each in df2.name)\n# Create and generate a word cloud image:\nwordcloud = WordCloud(max_words=200,colormap='RdBu', background_color=\"Blue\").generate(text)\nplt.figure(figsize=(10,6))\nplt.figure(figsize=(15,10))\n# Display the generated image:\nplt.imshow(wordcloud, interpolation='Bilinear')\nplt.axis(\"off\")\nplt.figure(1,figsize=(12, 12))\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2021-06-10T20:26:56.250414Z","iopub.execute_input":"2021-06-10T20:26:56.250933Z","iopub.status.idle":"2021-06-10T20:26:56.632348Z","shell.execute_reply.started":"2021-06-10T20:26:56.25088Z","shell.execute_reply":"2021-06-10T20:26:56.631449Z"},"_kg_hide-input":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"![](https://media0.giphy.com/media/l0MYEZkOB8xCYM7O8/200w.webp?cid=ecf05e478hjsigl71rgr4k8gd35k3rrz7h6ab3lpych7l4mp&rid=200w.webp&ct=g)","metadata":{"execution":{"iopub.status.busy":"2021-06-10T20:54:24.506372Z","iopub.execute_input":"2021-06-10T20:54:24.506733Z","iopub.status.idle":"2021-06-10T20:54:24.559286Z","shell.execute_reply.started":"2021-06-10T20:54:24.506699Z","shell.execute_reply":"2021-06-10T20:54:24.558329Z"}}},{"cell_type":"markdown","source":"#I couldn't even grab the foul ball.","metadata":{}}]}