{"id":6978,"date":"2023-11-02T00:00:00","date_gmt":"2023-11-02T04:00:00","guid":{"rendered":"https:\/\/www.sisense.com\/getting-started-with-data-analysis-in-python-after-using-sql\/"},"modified":"2024-11-29T06:45:22","modified_gmt":"2024-11-29T11:45:22","slug":"getting-started-with-data-analysis-in-python-after-using-sql","status":"publish","type":"post","link":"https:\/\/www.sisense.com\/blog\/getting-started-with-data-analysis-in-python-after-using-sql\/","title":{"rendered":"Getting started with Data Analysis in Python after using SQL"},"content":{"rendered":"<p><\/p>\r\n<p>SQL is the dominant language for data analysis because most of the time, the data you&#8217;re analyzing is stored in a database. And most analysis involves a lot of filtering, grouping, and counting \u2014 actions that SQL makes very easy.<\/p>\r\n<p>But sometimes you need to go beyond pure SQL. Some analyses require complex business logic or advanced statistics. While you can do advanced statistics in pure SQL, it&#8217;s often a lot simpler to use Python.<\/p>\r\n<p>This post is about starting that transition. If you&#8217;re already comfortable with SQL, and want to get started with Python, this is a look into some of the valuable transformations you can build. We&#8217;ll look at how to calculate linear regressions using Python, after using SQL to create our dataset.<\/p>\r\n<p>We&#8217;ll use a sample video game database and uncover the relationship between how many times frequent players play the game, and how much money they spend in-game.<\/p>\r\n<h2>Generating the dataset: Gameplays vs. spend<\/h2>\r\n<p>The database has a <strong>gameplays<\/strong> table, with one row for every time a player plays the game. Our first CTE will generate <strong>[user_id, num_plays]<\/strong>:<\/p>\r\n<pre class=\"wp-block-code\"><code>with\r\n user_plays as (\r\n   select\r\n     user_id\r\n     , count(1) as num_plays\r\n   from\r\n     gameplays\r\n   group by\r\n     1\r\n )<\/code><\/pre>\r\n<p>The database also has a <strong>purchases<\/strong> table, with one row for every purchase. The second CTE will generate <strong>[user_id, total_spent]<\/strong>:<\/p>\r\n<pre class=\"wp-block-code\"><code>, user_spend as (\r\n   select\r\n     user_id\r\n     , sum(price) as total_spent\r\n   from\r\n    purchases\r\n   group by\r\n     1\r\n )<\/code><\/pre>\r\n<p>Now we&#8217;ll join those two CTEs together, making the dataset we&#8217;ll use for our first correlation <strong>[num_plays, total_spent]<\/strong>. We&#8217;ll restrict the dataset to players who have played at least 150 games to focus on frequent players:<\/p>\r\n<pre class=\"wp-block-code\"><code>select\r\n num_plays\r\n , total_spent\r\nfrom\r\n user_plays\r\n join user_spend using (user_id)\r\nWhere\r\n num_plays &gt; 150<\/code><\/pre>\r\n<p>The output looks like this:<\/p>\r\n<figure class=\"wp-block-image fancybox\"><img decoding=\"async\" class=\"wp-image-74876\" src=\"https:\/\/cdn.sisense.com\/wp-content\/uploads\/Table-1.png\" alt=\" Gameplays vs. Spend chart\" \/><\/figure>\r\n<h2>The Hello World of linear regressions in Python<\/h2>\r\n<p>There are <a href=\"https:\/\/dtdocs.sisense.com\/article\/r-and-python\" target=\"_blank\" rel=\"noopener\">many Python libraries that help with data analysis<\/a>. We&#8217;ll start with <a href=\"https:\/\/seaborn.pydata.org\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">seaborn<\/a> and use the easiest way to make a linear regression, a <a href=\"https:\/\/seaborn.pydata.org\/generated\/seaborn.jointplot.html\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">jointplot<\/a>. As a bonus, this plot type also comes with histograms.<\/p>\r\n<p>Just import seaborn and pass the data frame generated from the SQL query to jointplot:<\/p>\r\n<pre class=\"wp-block-code\"><code>import pandas as pd\r\nimport seaborn as sns\r\n\r\nsns.jointplot(x='num_plays', y='total_spent', data=df, kind='reg')<\/code><\/pre>\r\n<p>Which generates our linear regression:<\/p>\r\n<figure class=\"wp-block-image fancybox\"><img decoding=\"async\" class=\"wp-image-74886\" src=\"https:\/\/cdn.sisense.com\/wp-content\/uploads\/Linear-Regression-image.png\" alt=\"Linear regression\" \/><\/figure>\r\n<p>Easy! As we could have predicted, players who play more also spend more, in general.<\/p>\r\n<p>However, scatter plots aren&#8217;t the right plot type to show dense clusters of information since they hide density \u2014 many data points could be hidden behind a single dot. In these cases, hex binning can tell the data\u2019s story more effectively.<\/p>\r\n<p>With hex binning, the plot area is divided into equally sized hexagons, and the color shading of each hexagon is based on how many data points fall within that hexagon&#8217;s boundaries.<\/p>\r\n<p><em>Why hexagons and not another shape? There are three regular shapes that can tessellate, or cover a surface without gaps or overlaps, in 2D plots. Squares and triangles are the other two. Hexagons are generally preferred for binning because they are closest to a circle (compared to triangles and squares). Circles are most representative of a &#8220;bin&#8221; because circles have the minimum distance between their borders and the center point among 2D shapes, which minimizes outliers in the bin.<\/em><\/p>\r\n<p>With seaborn, it&#8217;s easy to change from a scatter jointplot to one that uses hex binning. Simply change, the <strong>kind<\/strong> parameter to <strong>&#8216;hex&#8217;<\/strong>. While we&#8217;re changing things, let&#8217;s also change the color from blue to magenta with <strong>color=&#8217;m&#8217;<\/strong>:<\/p>\r\n<pre class=\"wp-block-code\"><code>sns.jointplot(x='num_plays', y='total_spent', data=df, kind='hex', color='m')<\/code><\/pre>\r\n<p>Making our new plot look like this:<\/p>\r\n<figure class=\"wp-block-image fancybox\"><img decoding=\"async\" class=\"wp-image-74891\" src=\"https:\/\/cdn.sisense.com\/wp-content\/uploads\/New-Plot.png\" alt=\"New plot\" \/><\/figure>\r\n<p>With this plot type, it&#8217;s easy to see where the density of data points varies, which we couldn&#8217;t tell from the scatter above.<\/p>\r\n<p><strong>Segmenting Our Dataset into Multiple Plots<\/strong>This video game is multi-platform, so let&#8217;s use Python to make a separate linear regression for each platform: Web, Android and iOS. First, we&#8217;ll update our query to include <strong>platform<\/strong>, in both CTEs and in the outputted data:<\/p>\r\n<pre class=\"wp-block-code\"><code>with\r\n user_plays as (\r\n   select\r\n     user_id\r\n     , platform\r\n     , count(1) as num_plays\r\n   from\r\n    gameplays\r\n   group by\r\n     1\r\n     , 2\r\n )\r\n , user_spend as (\r\n   select\r\n     user_id\r\n     , platform\r\n     , sum(price) as total_spent\r\n   from\r\n    purchases\r\n   group by\r\n     1\r\n     , 2\r\n )\r\nselect\r\n num_plays\r\n , total_spent\r\n , platform\r\nfrom\r\n user_plays\r\n join user_spend using (user_id, platform)\r\nwhere\r\n num_plays &gt; 150<\/code><\/pre>\r\n<p>Which has this output:\u00a0<\/p>\r\n<figure class=\"wp-block-image fancybox\"><img decoding=\"async\" class=\"wp-image-74881\" src=\"https:\/\/cdn.sisense.com\/wp-content\/uploads\/Table-2.png\" alt=\"Segmenting Dataset into Multiple Plots\" \/><\/figure>\r\n<p>And, still using seaborn, we&#8217;ll switch from jointplot to <a href=\"https:\/\/seaborn.pydata.org\/generated\/seaborn.lmplot.html\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">lmplot<\/a>. The lmplot function makes it easy for us to make one plot for each of our platforms. We no longer need the <strong>kind<\/strong> argument, instead we pass in the column to segment by, <strong>col=&#8217;platform&#8217;<\/strong>, and also tell lmplot to make each platform a different color using <strong>hue=&#8217;platform&#8217;<\/strong>:<\/p>\r\n<pre class=\"wp-block-code\"><code>sns.lmplot(x='num_plays', y='total_spent', data=df, col='platform', hue='platform')<\/code><\/pre>\r\n<p>We&#8217;ve created three plots at once:<\/p>\r\n<figure class=\"wp-block-image fancybox\"><img decoding=\"async\" class=\"wp-image-74898\" src=\"https:\/\/cdn.sisense.com\/wp-content\/uploads\/Three-Plots.png\" alt=\"Three plots\" \/><\/figure>\r\n<p>Segmenting out the data was informative! Web and iOS players have very different play count and spend distributions.<\/p>\r\n<h2>Bonus lap: 3D scatter plots<\/h2>\r\n<p>Sometimes it&#8217;s helpful to plot a third variable to shed more light on the distribution. In our case, we&#8217;ll include the number of purchases a player has made to tease out if we&#8217;re looking at few large purchases vs. many small purchases. In the <strong>user_spend<\/strong> CTE we&#8217;ll add <strong>count(1) as num_purchases<\/strong> to the select clause and include that column in the final SQL output as well.<\/p>\r\n<p>For 3D scatters, we will use <a href=\"https:\/\/matplotlib.org\/contents.html\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">matplotlib<\/a> instead of seaborn. First, we&#8217;ll import the library and set up the 3D context:<\/p>\r\n<pre class=\"wp-block-code\"><code>import pandas as pd\r\nimport matplotlib.pyplot as plt\r\nfrom mpl_toolkits.mplot3d import Axes3D\r\n\r\nax = plt.figure().add_subplot(111, projection='3d')<\/code><\/pre>\r\n<p>Unlike seaborn, matplotlib won&#8217;t auto-color the different platforms for us. So we&#8217;ll add a new column to our dataframe that maps Android to orange, Web to blue and iOS to green:<\/p>\r\n<pre class=\"wp-block-code\"><code>df['colors'] = df['platform'].replace({ 'android': 'orange', 'web': 'b', 'iOS': 'g'})<\/code><\/pre>\r\n<p>And now for the fun part, making the 3D scatter! Seaborn&#8217;s arguments were column names and the whole data frame. With matplotlib, we pass in each column whole (as x, y then z) and a fourth parameter sets the colors. After, we&#8217;ll label the axes:<\/p>\r\n<pre class=\"wp-block-code\"><code>ax.scatter(df['num_plays'], df['total_spent'], df['num_purchases'], c=df['colors'])\r\nax.set_xlabel('Number of Plays')\r\nax.set_ylabel('Total Spent')\r\nax.set_zlabel('Number of Purchases')<\/code><\/pre>\r\n<p>Running this generates our 3D scatter plot:<\/p>\r\n<figure class=\"wp-block-image fancybox\"><img decoding=\"async\" class=\"wp-image-74903\" src=\"https:\/\/cdn.sisense.com\/wp-content\/uploads\/3D-scatter-plots.png\" alt=\"3D scatter plots\" \/><\/figure>\r\n<p>While they look neat, 3D plots are often useless if they aren&#8217;t part of an animation or have some way of letting users move the perspective. Without that, a 2D rendering of a 3D plot can make it very difficult to see where the points actually are in the space.<\/p>\r\n<h2>Onward!<\/h2>\r\n<p>With just a few lines of Python, it&#8217;s easy to build on your SQL expertise to generate analyses that benefit from advanced statistics, especially when those statistics are inconvenient to calculate in SQL. Another benefit of using Python to visualize statistics is that you&#8217;re not tied to whatever built-in visualizations are available in your SQL environment.<\/p>\r\n<p>Of course, this is just the beginning. Python makes it easy to include complex business logic, more advanced statistics or more advanced visualizations. Sisense for Cloud Data Teams supports <a href=\"https:\/\/dtdocs.sisense.com\/article\/r-and-python\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">dozens of R and Python libraries made for data analysis and visualization<\/a>, ready and waiting for your next data project!<\/p>\r\n<p>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<\/p>","protected":false},"excerpt":{"rendered":"<p>SQL is the dominant language for data analysis because most of the time, the data you&#8217;re analyzing is stored in a database. And most analysis involves a lot of filtering, grouping, and counting \u2014 actions that SQL makes very easy&#8230;.<\/p>\n","protected":false},"author":4,"featured_media":8292,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_searchwp_excluded":"","footnotes":"","_links_to":"","_links_to_target":""},"categories":[44],"tags":[472],"application":[46],"buyer-role":[],"buyer-stage":[],"department":[],"industry":[],"topic":[],"class_list":["post-6978","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tech-talk","tag-data-team","application-bi-analytics-teams"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v23.5 (Yoast SEO v23.8) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>SQL to Python: A Beginner&#039;s Guide to Data Analysis | Sisense<\/title>\n<meta name=\"description\" content=\"If you\u2019re already comfortable with SQL, and want to get started with Python, start the transition by learning some of the valuable transformations you can build.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.sisense.com\/blog\/getting-started-with-data-analysis-in-python-after-using-sql\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Getting started with Data Analysis in Python after using SQL\" \/>\n<meta property=\"og:description\" content=\"SQL is the dominant language for data analysis because most of the time, the data you&#039;re analyzing is stored in a database. And most analysis involves a\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sisense.com\/blog\/getting-started-with-data-analysis-in-python-after-using-sql\/\" \/>\n<meta property=\"og:site_name\" content=\"Sisense\" \/>\n<meta property=\"article:published_time\" content=\"2023-11-02T04:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-29T11:45:22+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdn.sisense.com\/wp-content\/uploads\/yoast-python-analysis-blog-min.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Sisense Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:image\" content=\"https:\/\/cdn.sisense.com\/wp-content\/uploads\/yoast-python-analysis-blog-min.jpg\" \/>\n<meta name=\"twitter:creator\" content=\"@sisense\" \/>\n<meta name=\"twitter:site\" content=\"@sisense\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sisense Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.sisense.com\/blog\/getting-started-with-data-analysis-in-python-after-using-sql\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.sisense.com\/blog\/getting-started-with-data-analysis-in-python-after-using-sql\/\"},\"author\":{\"name\":\"Sisense Team\",\"@id\":\"https:\/\/www.sisense.com\/#\/schema\/person\/e70aa3a7bbc471e4b7b8c5a7d2b36115\"},\"headline\":\"Getting started with Data Analysis in Python after using SQL\",\"datePublished\":\"2023-11-02T04:00:00+00:00\",\"dateModified\":\"2024-11-29T11:45:22+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.sisense.com\/blog\/getting-started-with-data-analysis-in-python-after-using-sql\/\"},\"wordCount\":1051,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.sisense.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.sisense.com\/blog\/getting-started-with-data-analysis-in-python-after-using-sql\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/cdn.sisense.com\/wp-content\/uploads\/featured-python-analysis-blog-min-1.jpg\",\"keywords\":[\"data team\"],\"articleSection\":[\"Tech Talk\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.sisense.com\/blog\/getting-started-with-data-analysis-in-python-after-using-sql\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.sisense.com\/blog\/getting-started-with-data-analysis-in-python-after-using-sql\/\",\"url\":\"https:\/\/www.sisense.com\/blog\/getting-started-with-data-analysis-in-python-after-using-sql\/\",\"name\":\"SQL to Python: A Beginner's Guide to Data Analysis | Sisense\",\"isPartOf\":{\"@id\":\"https:\/\/www.sisense.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.sisense.com\/blog\/getting-started-with-data-analysis-in-python-after-using-sql\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.sisense.com\/blog\/getting-started-with-data-analysis-in-python-after-using-sql\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/cdn.sisense.com\/wp-content\/uploads\/featured-python-analysis-blog-min-1.jpg\",\"datePublished\":\"2023-11-02T04:00:00+00:00\",\"dateModified\":\"2024-11-29T11:45:22+00:00\",\"description\":\"If you\u2019re already comfortable with SQL, and want to get started with Python, start the transition by learning some of the valuable transformations you can build.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.sisense.com\/blog\/getting-started-with-data-analysis-in-python-after-using-sql\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.sisense.com\/blog\/getting-started-with-data-analysis-in-python-after-using-sql\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.sisense.com\/blog\/getting-started-with-data-analysis-in-python-after-using-sql\/#primaryimage\",\"url\":\"https:\/\/cdn.sisense.com\/wp-content\/uploads\/featured-python-analysis-blog-min-1.jpg\",\"contentUrl\":\"https:\/\/cdn.sisense.com\/wp-content\/uploads\/featured-python-analysis-blog-min-1.jpg\",\"width\":1200,\"height\":628,\"caption\":\"featured python analysis blog min 1\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.sisense.com\/blog\/getting-started-with-data-analysis-in-python-after-using-sql\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.sisense.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Getting started with Data Analysis in Python after using SQL\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.sisense.com\/#website\",\"url\":\"https:\/\/www.sisense.com\/\",\"name\":\"Sisense\",\"description\":\"Build your business with anywhere-analytics\",\"publisher\":{\"@id\":\"https:\/\/www.sisense.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.sisense.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.sisense.com\/#organization\",\"name\":\"Sisense\",\"url\":\"https:\/\/www.sisense.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.sisense.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdn.sisense.com\/wp-content\/uploads\/sisense-yoast-og.jpg\",\"contentUrl\":\"https:\/\/cdn.sisense.com\/wp-content\/uploads\/sisense-yoast-og.jpg\",\"width\":1200,\"height\":600,\"caption\":\"Sisense\"},\"image\":{\"@id\":\"https:\/\/www.sisense.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/sisense\",\"https:\/\/www.linkedin.com\/company\/sisense\",\"https:\/\/github.com\/sisense\/\"],\"description\":\"Sisense accelerates product innovation through AI\/ML capabilities. Our global analytics platform lets customers drive better, faster decisions for their business and end users.\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.sisense.com\/#\/schema\/person\/e70aa3a7bbc471e4b7b8c5a7d2b36115\",\"name\":\"Sisense Team\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.sisense.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/213e415f47bc3c7f0155a0755b1cea8c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/213e415f47bc3c7f0155a0755b1cea8c?s=96&d=mm&r=g\",\"caption\":\"Sisense Team\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"SQL to Python: A Beginner's Guide to Data Analysis | Sisense","description":"If you\u2019re already comfortable with SQL, and want to get started with Python, start the transition by learning some of the valuable transformations you can build.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.sisense.com\/blog\/getting-started-with-data-analysis-in-python-after-using-sql\/","og_locale":"en_US","og_type":"article","og_title":"Getting started with Data Analysis in Python after using SQL","og_description":"SQL is the dominant language for data analysis because most of the time, the data you're analyzing is stored in a database. And most analysis involves a","og_url":"https:\/\/www.sisense.com\/blog\/getting-started-with-data-analysis-in-python-after-using-sql\/","og_site_name":"Sisense","article_published_time":"2023-11-02T04:00:00+00:00","article_modified_time":"2024-11-29T11:45:22+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/cdn.sisense.com\/wp-content\/uploads\/yoast-python-analysis-blog-min.jpg","type":"image\/jpeg"}],"author":"Sisense Team","twitter_card":"summary_large_image","twitter_image":"https:\/\/cdn.sisense.com\/wp-content\/uploads\/yoast-python-analysis-blog-min.jpg","twitter_creator":"@sisense","twitter_site":"@sisense","twitter_misc":{"Written by":"Sisense Team","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.sisense.com\/blog\/getting-started-with-data-analysis-in-python-after-using-sql\/#article","isPartOf":{"@id":"https:\/\/www.sisense.com\/blog\/getting-started-with-data-analysis-in-python-after-using-sql\/"},"author":{"name":"Sisense Team","@id":"https:\/\/www.sisense.com\/#\/schema\/person\/e70aa3a7bbc471e4b7b8c5a7d2b36115"},"headline":"Getting started with Data Analysis in Python after using SQL","datePublished":"2023-11-02T04:00:00+00:00","dateModified":"2024-11-29T11:45:22+00:00","mainEntityOfPage":{"@id":"https:\/\/www.sisense.com\/blog\/getting-started-with-data-analysis-in-python-after-using-sql\/"},"wordCount":1051,"commentCount":0,"publisher":{"@id":"https:\/\/www.sisense.com\/#organization"},"image":{"@id":"https:\/\/www.sisense.com\/blog\/getting-started-with-data-analysis-in-python-after-using-sql\/#primaryimage"},"thumbnailUrl":"https:\/\/cdn.sisense.com\/wp-content\/uploads\/featured-python-analysis-blog-min-1.jpg","keywords":["data team"],"articleSection":["Tech Talk"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.sisense.com\/blog\/getting-started-with-data-analysis-in-python-after-using-sql\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.sisense.com\/blog\/getting-started-with-data-analysis-in-python-after-using-sql\/","url":"https:\/\/www.sisense.com\/blog\/getting-started-with-data-analysis-in-python-after-using-sql\/","name":"SQL to Python: A Beginner's Guide to Data Analysis | Sisense","isPartOf":{"@id":"https:\/\/www.sisense.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.sisense.com\/blog\/getting-started-with-data-analysis-in-python-after-using-sql\/#primaryimage"},"image":{"@id":"https:\/\/www.sisense.com\/blog\/getting-started-with-data-analysis-in-python-after-using-sql\/#primaryimage"},"thumbnailUrl":"https:\/\/cdn.sisense.com\/wp-content\/uploads\/featured-python-analysis-blog-min-1.jpg","datePublished":"2023-11-02T04:00:00+00:00","dateModified":"2024-11-29T11:45:22+00:00","description":"If you\u2019re already comfortable with SQL, and want to get started with Python, start the transition by learning some of the valuable transformations you can build.","breadcrumb":{"@id":"https:\/\/www.sisense.com\/blog\/getting-started-with-data-analysis-in-python-after-using-sql\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sisense.com\/blog\/getting-started-with-data-analysis-in-python-after-using-sql\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sisense.com\/blog\/getting-started-with-data-analysis-in-python-after-using-sql\/#primaryimage","url":"https:\/\/cdn.sisense.com\/wp-content\/uploads\/featured-python-analysis-blog-min-1.jpg","contentUrl":"https:\/\/cdn.sisense.com\/wp-content\/uploads\/featured-python-analysis-blog-min-1.jpg","width":1200,"height":628,"caption":"featured python analysis blog min 1"},{"@type":"BreadcrumbList","@id":"https:\/\/www.sisense.com\/blog\/getting-started-with-data-analysis-in-python-after-using-sql\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sisense.com\/"},{"@type":"ListItem","position":2,"name":"Getting started with Data Analysis in Python after using SQL"}]},{"@type":"WebSite","@id":"https:\/\/www.sisense.com\/#website","url":"https:\/\/www.sisense.com\/","name":"Sisense","description":"Build your business with anywhere-analytics","publisher":{"@id":"https:\/\/www.sisense.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.sisense.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.sisense.com\/#organization","name":"Sisense","url":"https:\/\/www.sisense.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sisense.com\/#\/schema\/logo\/image\/","url":"https:\/\/cdn.sisense.com\/wp-content\/uploads\/sisense-yoast-og.jpg","contentUrl":"https:\/\/cdn.sisense.com\/wp-content\/uploads\/sisense-yoast-og.jpg","width":1200,"height":600,"caption":"Sisense"},"image":{"@id":"https:\/\/www.sisense.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/sisense","https:\/\/www.linkedin.com\/company\/sisense","https:\/\/github.com\/sisense\/"],"description":"Sisense accelerates product innovation through AI\/ML capabilities. Our global analytics platform lets customers drive better, faster decisions for their business and end users."},{"@type":"Person","@id":"https:\/\/www.sisense.com\/#\/schema\/person\/e70aa3a7bbc471e4b7b8c5a7d2b36115","name":"Sisense Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sisense.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/213e415f47bc3c7f0155a0755b1cea8c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/213e415f47bc3c7f0155a0755b1cea8c?s=96&d=mm&r=g","caption":"Sisense Team"}}]}},"_links":{"self":[{"href":"https:\/\/www.sisense.com\/wp-json\/wp\/v2\/posts\/6978"}],"collection":[{"href":"https:\/\/www.sisense.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sisense.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sisense.com\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sisense.com\/wp-json\/wp\/v2\/comments?post=6978"}],"version-history":[{"count":1,"href":"https:\/\/www.sisense.com\/wp-json\/wp\/v2\/posts\/6978\/revisions"}],"predecessor-version":[{"id":23662,"href":"https:\/\/www.sisense.com\/wp-json\/wp\/v2\/posts\/6978\/revisions\/23662"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.sisense.com\/wp-json\/wp\/v2\/media\/8292"}],"wp:attachment":[{"href":"https:\/\/www.sisense.com\/wp-json\/wp\/v2\/media?parent=6978"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sisense.com\/wp-json\/wp\/v2\/categories?post=6978"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sisense.com\/wp-json\/wp\/v2\/tags?post=6978"},{"taxonomy":"application","embeddable":true,"href":"https:\/\/www.sisense.com\/wp-json\/wp\/v2\/application?post=6978"},{"taxonomy":"buyer-role","embeddable":true,"href":"https:\/\/www.sisense.com\/wp-json\/wp\/v2\/buyer-role?post=6978"},{"taxonomy":"buyer-stage","embeddable":true,"href":"https:\/\/www.sisense.com\/wp-json\/wp\/v2\/buyer-stage?post=6978"},{"taxonomy":"department","embeddable":true,"href":"https:\/\/www.sisense.com\/wp-json\/wp\/v2\/department?post=6978"},{"taxonomy":"industry","embeddable":true,"href":"https:\/\/www.sisense.com\/wp-json\/wp\/v2\/industry?post=6978"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.sisense.com\/wp-json\/wp\/v2\/topic?post=6978"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}