{"id":194009,"date":"2023-07-26T10:32:23","date_gmt":"2023-07-26T14:32:23","guid":{"rendered":"https:\/\/ibkrcampus.com\/?p=194009"},"modified":"2023-07-28T13:35:56","modified_gmt":"2023-07-28T17:35:56","slug":"dpylthondplyr-for-python","status":"publish","type":"post","link":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/dpylthondplyr-for-python\/","title":{"rendered":"Dplython\u2026dplyr for Python!"},"content":{"rendered":"\n<p>If you\u2019re an avid R user, you probably use the famous&nbsp;<a href=\"https:\/\/genomicsclass.github.io\/book\/pages\/dplyr_tutorial.html\">dplyr package<\/a>. Python has a package meant to be similar to&nbsp;<strong>dplyr<\/strong>, called&nbsp;<strong>dplython<\/strong>. This article will give an introduction for how to use&nbsp;<strong>dplython<\/strong>.<\/p>\n\n\n\n<p>For the examples below, we\u2019ll use a sample dataset that comes with R giving attributes about the US states, including population, area, and income levels. You can see the dataset by&nbsp;<a href=\"https:\/\/theautomatic.net\/wp-content\/uploads\/sites\/2\/2018\/09\/state_info.txt\">clicking here<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-initial-setup\"><strong>Initial setup<\/strong><\/h2>\n\n\n\n<p><strong>dplython<\/strong>&nbsp;can be installed using pip:.<\/p>\n\n\n\n<p><strong>pip install dplython<\/strong><\/p>\n\n\n\n<p>Once the package is installed, let\u2019s load a few methods from it, and read in our dataset.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># load packages\nfrom dplython import select, DplyFrame, X, arrange, count, sift, head, summarize, group_by, tail, mutate\nimport pandas as pd\n \n# read in data\nstate_df = pd.read_csv(\"state_info.txt\")<\/pre>\n\n\n\n<p>After we\u2019ve read in our data, we need to convert it to an object called a&nbsp;<em>DplyFrame<\/em>, which we do using a method from&nbsp;<strong>dplython<\/strong>. This&nbsp;<em>DplyFrame<\/em>&nbsp;object will allow us to perform \u201cdplyr-like\u201d operations.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">state_info = DplyFrame(state_df)<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>The Basics \u2013 How to select columns and get top rows<\/strong><\/h2>\n\n\n\n<p>With&nbsp;<strong>dplython<\/strong>, selecting columns is done like below:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">state_info >> select(X.State_Name, X.State_Region, X.Population)<\/pre>\n\n\n\n<p>Notice how we append X to each field name, which is a little different from the&nbsp;<em>select<\/em>&nbsp;command in&nbsp;<strong>dplyr<\/strong>. We also use&nbsp;<strong>&gt;&gt;<\/strong>&nbsp;instead of&nbsp;<strong>%&gt;%<\/strong>&nbsp;as a pipe operator. If you\u2019re not as familiar with&nbsp;<strong>dplyr<\/strong>&nbsp;from R, the pipe operator basically allows to you apply a function to the output of a function or object to the left the operator (the&nbsp;<strong>&gt;&gt;<\/strong>&nbsp;in&nbsp;<strong>dplython<\/strong>). In the case above, the&nbsp;<em>select<\/em>&nbsp;function is just being applied to&nbsp;<em>state_info<\/em>.<\/p>\n\n\n\n<p>To select only the top 10 or bottom 10 rows, we can chain the&nbsp;<em>head<\/em>&nbsp;or&nbsp;<em>tail<\/em>&nbsp;methods, respectively, to our line of code above. Here the&nbsp;<em>head<\/em>&nbsp;and&nbsp;<em>tail<\/em>&nbsp;functions are being applied to the result to the left of each respective pipe operator.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># get top ten rows with selected columns\nstate_info >> select(X.State_Name, X.State_Region, X.Population) >> head(10)\n \n# get bottom ten rows with selected columns\nstate_info >> select(X.State_Name, X.State_Region, X.Population) >> tail(10)<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How to filter rows<\/strong><\/h2>\n\n\n\n<p>Filtering can be done using the&nbsp;<strong>sift<\/strong>&nbsp;method. For example, if we want to get only the records where a state has an area less than 100,000 we would do this:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># filter initial data frame to states with areas less than 100,000 square miles\nstate_info >> sift(X.Area &lt; 100000)\n \n# filter rows and columns in one step\nstate_info >> sift(X.Area &lt; 100000) >> \n              select(X.State_Name, X.State_Region, X.Population, X.Area)<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Sorting datasets with dplython<\/strong><\/h2>\n\n\n\n<p>To sort our DplyFrame by a column, we can use the&nbsp;<em>arrange<\/em>&nbsp;method, like in&nbsp;<strong>dplyr<\/strong>:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># sort DplyFrame in ascending order by Area\nstate_info >> arrange(X.Area)\n \n# sort first by region, then by area\nstate_info >> arrange(X.State_Region, X.Area)<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How to create new columns with dplython<\/strong><\/h2>\n\n\n\n<p>Also similar to&nbsp;<strong>dplyr<\/strong>, we can use the&nbsp;<em>mutate<\/em>&nbsp;method to add fields to state_info:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">with_extra_field = state_info >> mutate(Name_Region = X.State_Name + '-' + X.State_Region)\n \n# create multiple fields in one step\nmore_fields = state_info >> mutate(Name_Region = X.State_Name + '-' + X.State_Region,\n                                   Area_Per_Thousand_Sq_Mile = X.Area \/ 1000)<\/pre>\n\n\n\n<p><em>with_extra_field<\/em>&nbsp;is now a DplyFrame containing the same fields as&nbsp;<em>state_info<\/em>, plus a field called \u201cName_Region\u201d.&nbsp;<em>more_fields<\/em>&nbsp;contains two extra fields \u2014 one concatenating the state name and region, and one dividing the state area field by 1000.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Summarizing data<\/strong><\/h2>\n\n\n\n<p>Aggregating data can be done using the&nbsp;<em>summarize<\/em>&nbsp;and&nbsp;<em>group_by<\/em>&nbsp;methods:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># get average area by region\nstate_info >> group_by(X.State_Region) >> summarize(average_region_area = X.Area.mean())\n \n# or do multiple aggregations in one step\nstate_info >> group_by(X.State_Region) >> summarize(average_region_area = X.Area.mean(), \\\n                                                 >> max_region_area = X.Area.max), \\\n                                                 >> max_region_income = X.Income.max())<\/pre>\n\n\n\n<p>The first line of code above will show the average (mean) state area by region. The second line calculates multiple aggregations in one step, including mean and max state areas by region, as well as max state income by region.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Transposing a dataset<\/strong><\/h2>\n\n\n\n<p><strong>dplython<\/strong>&nbsp;can also transpose datasets using&nbsp;<em>X.__T.<\/em>&nbsp;(period followed by double underscore and second period).<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># transpose state_info\nstate_info >> X._.T()<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How to join tables together<\/strong><\/h2>\n\n\n\n<p><strong>dplython<\/strong>, like&nbsp;<strong>dplyr<\/strong>, has several \u201cSQL-like\u201d functions for joining datasets together:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">from dplython import inner_join, left_join\n \n \nright_table = more_fields >> select(X.State_Name, X.Name_Region)\n \n# inner join\njoined_result = inner_join(state_info, right_table, on = \"State_Name\")\n \n# left_join\nleft_join_result = left_join(state_info, right_table, on = \"State_Name\")<\/pre>\n\n\n\n<p>In each type of join above, the first and second parameters are the left and right tables being joined. The \u201con\u201d parameter specifies what column or list of columns should be used as the key to join the tables together.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Counting values in a column<\/strong><\/h2>\n\n\n\n<p>To get the count of the values in a specific column, use the&nbsp;<em>count<\/em>&nbsp;function:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># get a count of each state region\nstate_info >> count(X.State_Region)<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How to randomly sample rows with dplython<\/strong><\/h2>\n\n\n\n<p>The&nbsp;<em>sample_n<\/em>&nbsp;function can be used to randomly sample rows from our dataset. You just need to pass whatever number of rows you want to randomly select (e.g. 10 in the below example).<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">from dplython import sample_n\n \n# randomly select ten rows from state_info\nstate_info >> sample_n(10)<\/pre>\n\n\n\n<p><strong>dplython<\/strong>&nbsp;can also sample a random proportion of a dataset. For example, if we want to randomly sample 70% of the rows, we can use the&nbsp;<em>sample_frac<\/em>&nbsp;function:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">from dplython import sample_frac\n \n# randomly sample 70% of the rows from state_info\nstate_info >> sample_frac(0.7)<\/pre>\n\n\n\n<p>The first line of code above will generate a DplyFrame with two columns: one showing the State Region, and the other showing the average area across each region. The second line contains this information, plus the max state area for each region, and the max state income for each region.<\/p>\n\n\n\n<p>That\u2019s it for this post! Please check out other Python posts of mine by&nbsp;<a href=\"https:\/\/theautomatic.net\/category\/python\/\">clicking here<\/a>.<\/p>\n\n\n\n<p><em>Originally posted on <a href=\"https:\/\/theautomatic.net\/2018\/09\/05\/dplyr-for-python-dpylthon\/\">TheAutomatic.net<\/a> blog.<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article will give an introduction for how to use\u00a0dplython.<\/p>\n","protected":false},"author":388,"featured_media":194015,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[339,343,349,338,341],"tags":[806,15618,595],"contributors-categories":[13695],"class_list":{"0":"post-194009","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-data-science","8":"category-programing-languages","9":"category-python-development","10":"category-ibkr-quant-news","11":"category-quant-development","12":"tag-data-science","13":"tag-dplython","14":"tag-python","15":"contributors-categories-theautomatic-net"},"pp_statuses_selecting_workflow":false,"pp_workflow_action":"current","pp_status_selection":"publish","acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.9 (Yoast SEO v27.4) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Dplython\u2026dplyr for Python! | IBKR Quant<\/title>\n<meta name=\"description\" content=\"This article will give an introduction for how to use\u00a0dplython.\" \/>\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.interactivebrokers.com\/campus\/wp-json\/wp\/v2\/posts\/194009\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Dplython\u2026dplyr for Python! | IBKR Campus US\" \/>\n<meta property=\"og:description\" content=\"This article will give an introduction for how to use\u00a0dplython.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/dpylthondplyr-for-python\/\" \/>\n<meta property=\"og:site_name\" content=\"IBKR Campus US\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-26T14:32:23+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-07-28T17:35:56+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/07\/python-black-keyboard-red-letters.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1000\" \/>\n\t<meta property=\"og:image:height\" content=\"563\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Andrew Treadway\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Andrew Treadway\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\n\t    \"@context\": \"https:\\\/\\\/schema.org\",\n\t    \"@graph\": [\n\t        {\n\t            \"@type\": \"NewsArticle\",\n\t            \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/dpylthondplyr-for-python\\\/#article\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/dpylthondplyr-for-python\\\/\"\n\t            },\n\t            \"author\": {\n\t                \"name\": \"Andrew Treadway\",\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/person\\\/d4018570a16fb867f1c08412fc9c64bc\"\n\t            },\n\t            \"headline\": \"Dplython\u2026dplyr for Python!\",\n\t            \"datePublished\": \"2023-07-26T14:32:23+00:00\",\n\t            \"dateModified\": \"2023-07-28T17:35:56+00:00\",\n\t            \"mainEntityOfPage\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/dpylthondplyr-for-python\\\/\"\n\t            },\n\t            \"wordCount\": 756,\n\t            \"commentCount\": 0,\n\t            \"publisher\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/dpylthondplyr-for-python\\\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2023\\\/07\\\/python-black-keyboard-red-letters.jpg\",\n\t            \"keywords\": [\n\t                \"Data Science\",\n\t                \"dplython\",\n\t                \"Python\"\n\t            ],\n\t            \"articleSection\": [\n\t                \"Data Science\",\n\t                \"Programming Languages\",\n\t                \"Python Development\",\n\t                \"Quant\",\n\t                \"Quant Development\"\n\t            ],\n\t            \"inLanguage\": \"en-US\",\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"CommentAction\",\n\t                    \"name\": \"Comment\",\n\t                    \"target\": [\n\t                        \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/dpylthondplyr-for-python\\\/#respond\"\n\t                    ]\n\t                }\n\t            ]\n\t        },\n\t        {\n\t            \"@type\": \"WebPage\",\n\t            \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/dpylthondplyr-for-python\\\/\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/dpylthondplyr-for-python\\\/\",\n\t            \"name\": \"Dplython\u2026dplyr for Python! | IBKR Campus US\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#website\"\n\t            },\n\t            \"primaryImageOfPage\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/dpylthondplyr-for-python\\\/#primaryimage\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/dpylthondplyr-for-python\\\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2023\\\/07\\\/python-black-keyboard-red-letters.jpg\",\n\t            \"datePublished\": \"2023-07-26T14:32:23+00:00\",\n\t            \"dateModified\": \"2023-07-28T17:35:56+00:00\",\n\t            \"description\": \"This article will give an introduction for how to use\u00a0dplython.\",\n\t            \"inLanguage\": \"en-US\",\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"ReadAction\",\n\t                    \"target\": [\n\t                        \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/dpylthondplyr-for-python\\\/\"\n\t                    ]\n\t                }\n\t            ]\n\t        },\n\t        {\n\t            \"@type\": \"ImageObject\",\n\t            \"inLanguage\": \"en-US\",\n\t            \"@id\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/ibkr-quant-news\\\/dpylthondplyr-for-python\\\/#primaryimage\",\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2023\\\/07\\\/python-black-keyboard-red-letters.jpg\",\n\t            \"contentUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2023\\\/07\\\/python-black-keyboard-red-letters.jpg\",\n\t            \"width\": 1000,\n\t            \"height\": 563,\n\t            \"caption\": \"Python\"\n\t        },\n\t        {\n\t            \"@type\": \"WebSite\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#website\",\n\t            \"url\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/\",\n\t            \"name\": \"IBKR Campus US\",\n\t            \"description\": \"Financial Education from Interactive Brokers\",\n\t            \"publisher\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\"\n\t            },\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"SearchAction\",\n\t                    \"target\": {\n\t                        \"@type\": \"EntryPoint\",\n\t                        \"urlTemplate\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/?s={search_term_string}\"\n\t                    },\n\t                    \"query-input\": {\n\t                        \"@type\": \"PropertyValueSpecification\",\n\t                        \"valueRequired\": true,\n\t                        \"valueName\": \"search_term_string\"\n\t                    }\n\t                }\n\t            ],\n\t            \"inLanguage\": \"en-US\"\n\t        },\n\t        {\n\t            \"@type\": \"Organization\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#organization\",\n\t            \"name\": \"Interactive Brokers\",\n\t            \"alternateName\": \"IBKR\",\n\t            \"url\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/\",\n\t            \"logo\": {\n\t                \"@type\": \"ImageObject\",\n\t                \"inLanguage\": \"en-US\",\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/logo\\\/image\\\/\",\n\t                \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2024\\\/05\\\/ibkr-campus-logo.jpg\",\n\t                \"contentUrl\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2024\\\/05\\\/ibkr-campus-logo.jpg\",\n\t                \"width\": 669,\n\t                \"height\": 669,\n\t                \"caption\": \"Interactive Brokers\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/logo\\\/image\\\/\"\n\t            },\n\t            \"publishingPrinciples\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/about-ibkr-campus\\\/\",\n\t            \"ethicsPolicy\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/cyber-security-notice\\\/\"\n\t        },\n\t        {\n\t            \"@type\": \"Person\",\n\t            \"@id\": \"https:\\\/\\\/ibkrcampus.com\\\/campus\\\/#\\\/schema\\\/person\\\/d4018570a16fb867f1c08412fc9c64bc\",\n\t            \"name\": \"Andrew Treadway\",\n\t            \"description\": \"Andrew Treadway currently works as a Senior Data Scientist, and has experience doing analytics, software automation, and ETL. He completed a master\u2019s degree in computer science \\\/ machine learning, and an undergraduate degree in pure mathematics. Connect with him on LinkedIn: https:\\\/\\\/www.linkedin.com\\\/in\\\/andrew-treadway-a3b19b103\\\/In addition to TheAutomatic.net blog, he also teaches in-person courses on Python and R through my NYC meetup: more details.\",\n\t            \"sameAs\": [\n\t                \"https:\\\/\\\/theautomatic.net\\\/about-me\\\/\"\n\t            ],\n\t            \"url\": \"https:\\\/\\\/www.interactivebrokers.com\\\/campus\\\/author\\\/andrewtreadway\\\/\"\n\t        }\n\t    ]\n\t}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Dplython\u2026dplyr for Python! | IBKR Quant","description":"This article will give an introduction for how to use\u00a0dplython.","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.interactivebrokers.com\/campus\/wp-json\/wp\/v2\/posts\/194009\/","og_locale":"en_US","og_type":"article","og_title":"Dplython\u2026dplyr for Python! | IBKR Campus US","og_description":"This article will give an introduction for how to use\u00a0dplython.","og_url":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/dpylthondplyr-for-python\/","og_site_name":"IBKR Campus US","article_published_time":"2023-07-26T14:32:23+00:00","article_modified_time":"2023-07-28T17:35:56+00:00","og_image":[{"width":1000,"height":563,"url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/07\/python-black-keyboard-red-letters.jpg","type":"image\/jpeg"}],"author":"Andrew Treadway","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Andrew Treadway","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"NewsArticle","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/dpylthondplyr-for-python\/#article","isPartOf":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/dpylthondplyr-for-python\/"},"author":{"name":"Andrew Treadway","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/person\/d4018570a16fb867f1c08412fc9c64bc"},"headline":"Dplython\u2026dplyr for Python!","datePublished":"2023-07-26T14:32:23+00:00","dateModified":"2023-07-28T17:35:56+00:00","mainEntityOfPage":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/dpylthondplyr-for-python\/"},"wordCount":756,"commentCount":0,"publisher":{"@id":"https:\/\/ibkrcampus.com\/campus\/#organization"},"image":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/dpylthondplyr-for-python\/#primaryimage"},"thumbnailUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/07\/python-black-keyboard-red-letters.jpg","keywords":["Data Science","dplython","Python"],"articleSection":["Data Science","Programming Languages","Python Development","Quant","Quant Development"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/dpylthondplyr-for-python\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/dpylthondplyr-for-python\/","url":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/dpylthondplyr-for-python\/","name":"Dplython\u2026dplyr for Python! | IBKR Campus US","isPartOf":{"@id":"https:\/\/ibkrcampus.com\/campus\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/dpylthondplyr-for-python\/#primaryimage"},"image":{"@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/dpylthondplyr-for-python\/#primaryimage"},"thumbnailUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/07\/python-black-keyboard-red-letters.jpg","datePublished":"2023-07-26T14:32:23+00:00","dateModified":"2023-07-28T17:35:56+00:00","description":"This article will give an introduction for how to use\u00a0dplython.","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/dpylthondplyr-for-python\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.interactivebrokers.com\/campus\/ibkr-quant-news\/dpylthondplyr-for-python\/#primaryimage","url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/07\/python-black-keyboard-red-letters.jpg","contentUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/07\/python-black-keyboard-red-letters.jpg","width":1000,"height":563,"caption":"Python"},{"@type":"WebSite","@id":"https:\/\/ibkrcampus.com\/campus\/#website","url":"https:\/\/ibkrcampus.com\/campus\/","name":"IBKR Campus US","description":"Financial Education from Interactive Brokers","publisher":{"@id":"https:\/\/ibkrcampus.com\/campus\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ibkrcampus.com\/campus\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/ibkrcampus.com\/campus\/#organization","name":"Interactive Brokers","alternateName":"IBKR","url":"https:\/\/ibkrcampus.com\/campus\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/logo\/image\/","url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/ibkr-campus-logo.jpg","contentUrl":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2024\/05\/ibkr-campus-logo.jpg","width":669,"height":669,"caption":"Interactive Brokers"},"image":{"@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/logo\/image\/"},"publishingPrinciples":"https:\/\/www.interactivebrokers.com\/campus\/about-ibkr-campus\/","ethicsPolicy":"https:\/\/www.interactivebrokers.com\/campus\/cyber-security-notice\/"},{"@type":"Person","@id":"https:\/\/ibkrcampus.com\/campus\/#\/schema\/person\/d4018570a16fb867f1c08412fc9c64bc","name":"Andrew Treadway","description":"Andrew Treadway currently works as a Senior Data Scientist, and has experience doing analytics, software automation, and ETL. He completed a master\u2019s degree in computer science \/ machine learning, and an undergraduate degree in pure mathematics. Connect with him on LinkedIn: https:\/\/www.linkedin.com\/in\/andrew-treadway-a3b19b103\/In addition to TheAutomatic.net blog, he also teaches in-person courses on Python and R through my NYC meetup: more details.","sameAs":["https:\/\/theautomatic.net\/about-me\/"],"url":"https:\/\/www.interactivebrokers.com\/campus\/author\/andrewtreadway\/"}]}},"jetpack_featured_media_url":"https:\/\/www.interactivebrokers.com\/campus\/wp-content\/uploads\/sites\/2\/2023\/07\/python-black-keyboard-red-letters.jpg","_links":{"self":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/194009","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/users\/388"}],"replies":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/comments?post=194009"}],"version-history":[{"count":0,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/posts\/194009\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/media\/194015"}],"wp:attachment":[{"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/media?parent=194009"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/categories?post=194009"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/tags?post=194009"},{"taxonomy":"contributors-categories","embeddable":true,"href":"https:\/\/ibkrcampus.com\/campus\/wp-json\/wp\/v2\/contributors-categories?post=194009"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}