{"id":2999,"date":"2020-04-30T03:54:21","date_gmt":"2020-04-30T03:54:21","guid":{"rendered":"https:\/\/www.staging6.machinelearningplus.com\/?p=2999"},"modified":"2022-03-08T16:41:11","modified_gmt":"2022-03-08T16:41:11","slug":"dataframes-in-julia","status":"publish","type":"post","link":"https:\/\/machinelearningplus.com\/julia\/dataframes-in-julia\/","title":{"rendered":"DataFrames in Julia"},"content":{"rendered":"<em>DataFrame is a 2 dimensional mutable data structure, that is used for handling tabular data. Unlike Arrays and Matrices, a DataFrame can hold columns of different data types<\/em>\n\n<em>The <code>DataFrames<\/code> package in Julia provides the <code>DataFrame<\/code> object which is used to hold and manipulate tabular data in a flexible and convenient way. It is quite essential for master DataFrames in order to perform data analysis, building machine learning models and other scientific computing. <\/em>\n\nIn this tutorial, I explain how to work with DataFrames in Julia.\n\n<h2 id=\"content\">Content<\/h2>\n\n<ol>\n    <li>Install DataFrames package in Julia<\/li>\n    <li>Create New DataFrame<\/li>\n    <li>Import Data<\/li>\n    <li>Data Exploration<\/li>\n    <li>Indexing the DataFrame<\/li>\n    <li>Summarizing the DataFrame<\/li>\n    <li>Join DataFrames<\/li>\n    <li>Export DataFrames<\/li>\n<\/ol>\n\n\n\n<h2 id=\"1installdataframespackageinjulia\">1. Install DataFrames package in Julia<\/h2>\n\nYou can install any package in Julia with <code>Pkg.add()<\/code> command. Let&#8217;s install <code>DataFrames<\/code> in Julia\n\n<pre><code class=\"julia language-julia\">using Pkg\nPkg.add(\"DataFrames\")\n<\/code><\/pre>\n\n<h2 id=\"2createnewdataframe\">2. Create new dataframe<\/h2>\n\nIn Julia, You can create a DataFrame in multiple ways:\n\n(i) Using a single statement using <code>DataFrame()<\/code>\n(ii) Column by column\n(iii) Row by row\n\n<h3 id=\"21createnewdataframeinasinglego\">(i) Create new dataframe in a single statement<\/h3>\n\nYou can create one using the <code>DataFrame()<\/code> function by enclosing the column names and values inside it. To do that you need to first load the <code>DataFrames<\/code> package by writing <code>using DataFrames<\/code> before using the function.\n\n<pre><code class=\"julia language-julia\">using DataFrames\n\ndf = DataFrame(A = 1:5, B = [\"A\", \"B\", \"C\", \"D\", \"E\"])\n<\/code><\/pre>\n\n<img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone size-medium wp-image-3081\" src=\"https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_1-216x300.png\" alt=\"\" width=\"216\" height=\"300\" srcset=\"https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_1-216x300.png 216w, https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_1.png 290w\" sizes=\"(max-width: 216px) 100vw, 216px\" \/>\n\n<h3 id=\"22createnewdataframecolumnbycolumn\">(ii) Create new dataframe column by column<\/h3>\n\nAlternately, You can create an empty Julia DataFrame using <code>DataFrame()<\/code> function and then add columns one by one.\n\nSince DataFrames are mutable, you can modify them afterward as well.\n\n<pre><code class=\"julia language-julia\">\n# Initialize Empty DataFrame\ndf = DataFrame()\n\n# Add Columns\ndf.A = 1:5\n\ndf.B = [\"A\", \"B\", \"C\", \"D\", \"E\"]\n\ndf\n<\/code><\/pre>\n\n<img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone size-medium wp-image-3081\" src=\"https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_1-216x300.png\" alt=\"\" width=\"216\" height=\"300\" srcset=\"https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_1-216x300.png 216w, https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_1.png 290w\" sizes=\"(max-width: 216px) 100vw, 216px\" \/>\n\n<h3 id=\"23createnewdataframerowbyrow\">(iii) Create new dataframe row by row<\/h3>\n\nCreate an empty Julia DataFrame by enclosing column names and datatype of column inside <code>DataFrame()<\/code> function.\n\nNow you can add rows one by one using <code>push!()<\/code> function. This is like row binding.\n\n<pre><code class=\"julia language-julia\"># Initialize empty DataFrame with columns\ndf = DataFrame(A = Int[], B = String[])\n\n# Add Rows\npush!(df, (1, \"A\"))\npush!(df, (2, \"B\"))\npush!(df, (3, \"C\"))\npush!(df, (4, \"D\"))\npush!(df, (5, \"E\"))\n\ndf\n<\/code><\/pre>\n\n<img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone size-medium wp-image-3081\" src=\"https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_1-216x300.png\" alt=\"\" width=\"216\" height=\"300\" srcset=\"https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_1-216x300.png 216w, https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_1.png 290w\" sizes=\"(max-width: 216px) 100vw, 216px\" \/>\n\n<h2 id=\"3readimportfiles\">3. Import Data<\/h2>\n\nYou have seen how to create DataFrames. Now, let&#8217;s see how to import the existing files inside Julia as a <code>DataFrame<\/code>.\n\nThere are different ways to import a dataset file. Let&#8217;s go through 2 of the most popular one.\n\n(i) Using <code>readtable()<\/code>\n(ii) Using <code>CSV<\/code> package\n\n<h3 id=\"31usingreadtablefunctionfromdataframespackage\">3.1 Using <code>readtable()<\/code> function from <code>DataFrames<\/code> package<\/h3>\n\n<code>readtable()<\/code> function is used to read data from a CSV-like file\n\n<pre><code class=\"julia language-julia\"># Import data using readtable\nusing DataFrames \ndf = readtable(\"Data\/insurance.csv\")\nhead(df)\n<\/code><\/pre>\n\n<img decoding=\"async\" class=\"alignnone size-medium wp-image-3083\" src=\"https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_2-300x158.png\" alt=\"\" width=\"300\" height=\"158\" srcset=\"https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_2-300x158.png 300w, https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_2-768x405.png 768w, https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_2.png 824w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/>\n\n<h3 id=\"32usingcsvpacakageandlateronconvertingthefiletodataframe\">3.2 Using CSV package and later on converting the file to DataFrame<\/h3>\n\nRead the file with <code>CSV.File()<\/code> function. Now, covert it to a DataFrame using <code>DataFrame<\/code> function\n\n<pre><code class=\"julia language-julia\"># Add \"CSV\" package\nusing Pkg\nPkg.add(\"CSV\")\n<\/code><\/pre>\n\n<pre><code class=\"julia language-julia\"># Read the file using CSV.File and convert it to DataFrame\nusing CSV\ndf = DataFrame(CSV.File(\"Data\/insurance.csv\"))\nhead(df)\n<\/code><\/pre>\n\n<img decoding=\"async\" class=\"alignnone size-medium wp-image-3083\" src=\"https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_2-300x158.png\" alt=\"\" width=\"300\" height=\"158\" srcset=\"https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_2-300x158.png 300w, https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_2-768x405.png 768w, https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_2.png 824w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/>\n\n<h2 id=\"4dataexploration\">4. Data Exploration<\/h2>\n\nNow, once you know how to read and create DataFrames, how about exploring it a bit. Let&#8217;s see some useful examples.\n\n<h3 id=\"41showallrowsandcolumnsofdataframe\">4.1 Show all rows and columns of DataFrame<\/h3>\n\nBy default, Julia doesn&#8217;t print all the rows and columns of a DataFrame because of obvious reasons like space and storage issues. But if you want to see all the rows and columns, it&#8217;s possible using <code>show()<\/code> function with <code>allrows<\/code> &amp; <code>allcols<\/code> arguments.\n\n<pre><code class=\"julia language-julia\"># Show all rows of DataFrame\nshow(df, allrows=true)\n\n# Show all columns of DataFrame\nshow(df, allcols=true)\n<\/code><\/pre>\n\nI am not printing it here because of space constraints. But trust me, it works.\n\n<h3 id=\"42showtopbottomrowsofdataframe\">4.2 Show top\/bottom rows of DataFrame<\/h3>\n\n<code>head<\/code> &amp; <code>first<\/code> functions are used to see top n rows of a DataFrame\n\n<pre><code class=\"julia language-julia\"># Print first n rows of df\nhead(df, 10)\n\nfirst(df, 10)\n<\/code><\/pre>\n\n<img decoding=\"async\" class=\"alignnone size-medium wp-image-3084\" src=\"https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_3-300x221.png\" alt=\"\" width=\"300\" height=\"221\" srcset=\"https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_3-300x221.png 300w, https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_3-768x566.png 768w, https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_3.png 822w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/>\n\n<code>tail<\/code> &amp; <code>last<\/code> functions are used to see bottom n rows of a DataFrame\n\n<pre><code class=\"julia language-julia\"># Print last n rows of df\ntail(df, 10)\n\nlast(df, 10)\n<\/code><\/pre>\n\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-3085\" src=\"https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_4-300x224.png\" alt=\"\" width=\"300\" height=\"224\" srcset=\"https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_4-300x224.png 300w, https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_4-768x573.png 768w, https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_4.png 812w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/>\n\n<h3 id=\"43sizeofdataframe\">4.3 Size of DataFrame<\/h3>\n\nThe <code>size<\/code> function is used to see the size of a DataFrame. By size, I mean the number or rows and columns of the DataFrame.\n\n<pre><code class=\"julia language-julia\"># Shape and size of the data\nprintln(size(df))\n\n# Summary function also serves the purpose\nprintln(summary(df))\n<\/code><\/pre>\n\n<h3 id=\"44getcolumnnamesofdataframe\">4.4 Get column names of DataFrame<\/h3>\n\n<code>names<\/code> function is used to get the column names of a DataFrame\n\n<pre><code class=\"julia language-julia\"># Shape and size of the data\nnames(df)\n<\/code><\/pre>\n\n<h3 id=\"45descriptionofdataframe\">4.5 Description of DataFrame<\/h3>\n\n<code>describe<\/code> functions is used to get the description of a DataFrame. It tells us about matrices like the variable type, mean, median, max, number of unique values, number of missing values of every column in the DataFrame.\n\n<pre><code class=\"julia language-julia\"># Describe the data\ndescribe(df)\n<\/code><\/pre>\n\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-3086\" src=\"https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_5-300x143.png\" alt=\"\" width=\"300\" height=\"143\" srcset=\"https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_5-300x143.png 300w, https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_5-1024x487.png 1024w, https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_5-768x365.png 768w, https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_5.png 1056w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/>\n\n<h2 id=\"5indexingandfilteringthedataframe\">5. Indexing and filtering the DataFrame (multiple methods)<\/h2>\n\nJulia follows &#8220;1 based indexing&#8221; i.e the first element starts with 1. R programming is also a 1 based indexing language, while Python is a 0 based indexing language.\n\n<h4>Selecting specific rows<\/h4>\n\nRows and columns in DataFrame can be indexed by enclosing the index number inside <code>[]<\/code> big brackets.\n\n<pre><code class=\"julia language-julia\"># Select specific rows in the data\ndf[1:5,:]\n<\/code><\/pre>\n\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-3087\" src=\"https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_6-300x144.png\" alt=\"\" width=\"300\" height=\"144\" srcset=\"https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_6-300x144.png 300w, https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_6-768x370.png 768w, https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_6.png 810w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/>\n\n<h4>Selecting specific rows and columns<\/h4>\n\nWhen you want to index all the rows\/columns, <code>:<\/code> colons are used. Likewise, I have used to index all columns in the above example.\n\nJulia follows the name based indexing as well i.e. specify the column name while indexing followed by <code>:<\/code> colon.\n\n<pre><code class=\"julia language-julia\"># Select specific rows and columns by column names in the data\ndf[1:5,[:age,:sex]]\n<\/code><\/pre>\n\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-3088\" src=\"https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_7-200x300.png\" alt=\"\" width=\"200\" height=\"300\" srcset=\"https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_7-200x300.png 200w, https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_7.png 260w\" sizes=\"(max-width: 200px) 100vw, 200px\" \/>\n\n<pre><code class=\"julia language-julia\"># Select only one column, as a dataframe\ndf[1:5, [:age]]\n<\/code><\/pre>\n\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-3089\" src=\"https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_8-189x300.png\" alt=\"\" width=\"189\" height=\"300\" srcset=\"https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_8-189x300.png 189w, https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_8.png 248w\" sizes=\"(max-width: 189px) 100vw, 189px\" \/>\n\nYou must have noticed, I have used another <code>[]<\/code> square brackets in the column indexed space\/area. This is required if you want to get a DataFrame. But, if you wish to get a vector, you need to remove the <code>[]<\/code> square brackets. Let&#8217;s see it with an example\n\n<pre><code class=\"julia language-julia\"># Select only one column, as a vector\ndf[1:5,:age]\n#&gt; Returns a vector\n<\/code><\/pre>\n\nYou can use <code>select<\/code> function as well to subset the data .\n\n<pre><code class=\"julia language-julia\"># Select columns using select() function\nfirst(select(df, :age),5)\n<\/code><\/pre>\n\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-3089\" src=\"https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_8-189x300.png\" alt=\"\" width=\"189\" height=\"300\" srcset=\"https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_8-189x300.png 189w, https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_8.png 248w\" sizes=\"(max-width: 189px) 100vw, 189px\" \/>\n\n<pre><code class=\"julia language-julia\"># Select all the column except \"age\" column\nfirst(select(df, Not(:age)),5)\n<\/code><\/pre>\n\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-3091\" src=\"https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_10-300x159.png\" alt=\"\" width=\"300\" height=\"159\" srcset=\"https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_10-300x159.png 300w, https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_10.png 726w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/>\n\nYou can subset the data based on the values as well. You need to use a <code>.<\/code> operator before the less than\/greater than\/ equal to operators. Let&#8217;s see it with an example\n\n<pre><code class=\"julia language-julia\"># Filter based on values. Select all the rows where age is greater than 20.\nfirst(df[df.age .&gt; 20,:],5)\n<\/code><\/pre>\n\n<h2 id=\"6summarizingdata\">6. Grouping and Summarizing Data<\/h2>\n\nYou can group and summarize the data using <code>aggregate<\/code> function. You need to specify the aggregating operation you want to perform. Let&#8217;s see it with examples. I am going to get the sum and product of all the values in the columns.\n\n<pre><code class=\"julia language-julia\"># Subset the numeric columns\nnum_df = df[:,[:age,:bmi,:children,:expenses]]\n\n# Aggregate the data to find sum of all the column values\nprintln(aggregate(num_df, sum), \"\\n\\n\")\n\n# Aggregate the data to find product of all the column values\nprintln(aggregate(num_df, prod))\n<\/code><\/pre>\n\nYou can get the basic summary of any of the columns using <code>describe<\/code> function. I have explained it earlier as well.\n\n<pre><code class=\"julia language-julia\"># summarize data\ndescribe(df[!,[:age]])\n<\/code><\/pre>\n\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-3092\" src=\"https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_13-300x72.png\" alt=\"\" width=\"300\" height=\"72\" srcset=\"https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_13-300x72.png 300w, https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_13-768x185.png 768w, https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_13.png 898w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/>\n\n<code>!<\/code> can also be used in place of <code>:<\/code> when you wish to index all the values.\n\n<h2 id=\"7joindata\">7. Join Data<\/h2>\n\nUsing <code>join<\/code> function, you can join multiple DataFrames to create a single DataFrame based on a common column .\n\nYou can specify the type of join you wish to perform. Be it inner, left, right, outer, self join.\n\n<pre><code class=\"julia language-julia\"># Define 2 datasets\nemployee_df = DataFrame(emp_code = [\"N_1\", \"N_2\", \"N_3\", \"N_4\"], \nemp_name = [\"Kabir\", \"Aryan\", \"Khushi\", \"Mehak\"])\n\ndesignation_df = DataFrame(emp_code = [\"N_1\", \"N_2\", \"N_3\"], \nemp_designation = [\"Data Scientist\", \"Data Engineer\", \"VP\"])\n\n# Create a new DataFrame by joining the two DataFrames, primary key being \"emp_code\"\njoin(employee_df, designation_df, on = :emp_code)\n<\/code><\/pre>\n\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-3093\" src=\"https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_14-300x164.png\" alt=\"\" width=\"300\" height=\"164\" srcset=\"https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_14-300x164.png 300w, https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_14.png 562w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/>\n\nBy default, it&#8217;s an inner join. Let&#8217;s see how to perform a left join\n\n<pre><code class=\"julia language-julia\"># left join\njoin(employee_df, designation_df, on = :emp_code, kind = :left)\n<\/code><\/pre>\n\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-3094\" src=\"https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_15-300x196.png\" alt=\"\" width=\"300\" height=\"196\" srcset=\"https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_15-300x196.png 300w, https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/dataframes_julia_15.png 544w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/>\n\n<h2 id=\"8exportdataframes\">8. Export DataFrames<\/h2>\n\n<code>writetable<\/code> function is used to export the data.\n\n<pre><code class=\"julia language-julia\">writetable(\"output.csv\", df)\n<\/code><\/pre>\n\n<h2 id=\"conculusion\">Conclusion<\/h2>\n\nSo, now you should have a fair idea of how to handle DataFrames in Julia. Next, I will see you with more Data Science oriented topics in Julia.\n\nRead more about Julia <a href=\"https:\/\/machinelearningplus.com\/julia\/\">here<\/a><!-- \/wp:post-content -->","protected":false},"excerpt":{"rendered":"<p>DataFrame is a 2 dimensional mutable data structure, that is used for handling tabular data. Unlike Arrays and Matrices, a DataFrame can hold columns of different data types The DataFrames package in Julia provides the DataFrame object which is used to hold and manipulate tabular data in a flexible and convenient way. It is quite [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":2825,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"site-sidebar-layout":"default","site-content-layout":"default","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[101],"tags":[27,116,102,106,103],"class_list":["post-2999","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-julia","tag-data-manipulation","tag-dataframe","tag-julia","tag-julia-packages","tag-machine-learning"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>DataFrames in Julia - machinelearningplus<\/title>\n<meta name=\"description\" content=\"DataFrames is a package in Julia which is widely used in data-intensive fields like data science, data analytics, scientific computing etc.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/localhost:8080\/julia\/dataframes-in-julia\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"DataFrames in Julia - machinelearningplus\" \/>\n<meta property=\"og:description\" content=\"DataFrames is a package in Julia which is widely used in data-intensive fields like data science, data analytics, scientific computing etc.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/localhost:8080\/julia\/dataframes-in-julia\/\" \/>\n<meta property=\"og:site_name\" content=\"machinelearningplus\" \/>\n<meta property=\"article:published_time\" content=\"2020-04-30T03:54:21+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-03-08T16:41:11+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/localhost:8080\/wp-content\/uploads\/2020\/04\/Julia_Programming_Language-min.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"776\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Kabir\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Kabir\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/localhost:8080\\\/julia\\\/dataframes-in-julia\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/localhost:8080\\\/julia\\\/dataframes-in-julia\\\/\"},\"author\":{\"name\":\"Kabir\",\"@id\":\"https:\\\/\\\/machinelearningplus.com\\\/#\\\/schema\\\/person\\\/01b9d7b59990cde0e05068914456b5ad\"},\"headline\":\"DataFrames in Julia\",\"datePublished\":\"2020-04-30T03:54:21+00:00\",\"dateModified\":\"2022-03-08T16:41:11+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/localhost:8080\\\/julia\\\/dataframes-in-julia\\\/\"},\"wordCount\":919,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/machinelearningplus.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/localhost:8080\\\/julia\\\/dataframes-in-julia\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/machinelearningplus.com\\\/wp-content\\\/uploads\\\/2020\\\/04\\\/Julia_Programming_Language-min.png\",\"keywords\":[\"Data Manipulation\",\"DataFrame\",\"Julia\",\"Julia Packages\",\"Machine Learning\"],\"articleSection\":[\"Julia\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/localhost:8080\\\/julia\\\/dataframes-in-julia\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/localhost:8080\\\/julia\\\/dataframes-in-julia\\\/\",\"url\":\"https:\\\/\\\/localhost:8080\\\/julia\\\/dataframes-in-julia\\\/\",\"name\":\"DataFrames in Julia - machinelearningplus\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/machinelearningplus.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/localhost:8080\\\/julia\\\/dataframes-in-julia\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/localhost:8080\\\/julia\\\/dataframes-in-julia\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/machinelearningplus.com\\\/wp-content\\\/uploads\\\/2020\\\/04\\\/Julia_Programming_Language-min.png\",\"datePublished\":\"2020-04-30T03:54:21+00:00\",\"dateModified\":\"2022-03-08T16:41:11+00:00\",\"description\":\"DataFrames is a package in Julia which is widely used in data-intensive fields like data science, data analytics, scientific computing etc.\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/localhost:8080\\\/julia\\\/dataframes-in-julia\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/localhost:8080\\\/julia\\\/dataframes-in-julia\\\/#primaryimage\",\"url\":\"https:\\\/\\\/machinelearningplus.com\\\/wp-content\\\/uploads\\\/2020\\\/04\\\/Julia_Programming_Language-min.png\",\"contentUrl\":\"https:\\\/\\\/machinelearningplus.com\\\/wp-content\\\/uploads\\\/2020\\\/04\\\/Julia_Programming_Language-min.png\",\"width\":1200,\"height\":776,\"caption\":\"Julian Programming Language\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/machinelearningplus.com\\\/#website\",\"url\":\"https:\\\/\\\/machinelearningplus.com\\\/\",\"name\":\"machinelearningplus\",\"description\":\"Learn Data Science (AI \\\/ ML) Online\",\"publisher\":{\"@id\":\"https:\\\/\\\/machinelearningplus.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/machinelearningplus.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/machinelearningplus.com\\\/#organization\",\"name\":\"machinelearningplus\",\"url\":\"https:\\\/\\\/machinelearningplus.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/machinelearningplus.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/machinelearningplus.com\\\/wp-content\\\/uploads\\\/2022\\\/05\\\/MachineLearningplus-logo.svg\",\"contentUrl\":\"https:\\\/\\\/machinelearningplus.com\\\/wp-content\\\/uploads\\\/2022\\\/05\\\/MachineLearningplus-logo.svg\",\"width\":348,\"height\":36,\"caption\":\"machinelearningplus\"},\"image\":{\"@id\":\"https:\\\/\\\/machinelearningplus.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/machinelearningplus.com\\\/#\\\/schema\\\/person\\\/01b9d7b59990cde0e05068914456b5ad\",\"name\":\"Kabir\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/machinelearningplus.com\\\/wp-content\\\/litespeed\\\/avatar\\\/5146322f528131e2446a7a18ab6020aa.jpg?ver=1783629629\",\"url\":\"https:\\\/\\\/machinelearningplus.com\\\/wp-content\\\/litespeed\\\/avatar\\\/5146322f528131e2446a7a18ab6020aa.jpg?ver=1783629629\",\"contentUrl\":\"https:\\\/\\\/machinelearningplus.com\\\/wp-content\\\/litespeed\\\/avatar\\\/5146322f528131e2446a7a18ab6020aa.jpg?ver=1783629629\",\"caption\":\"Kabir\"},\"url\":\"https:\\\/\\\/machinelearningplus.com\\\/author\\\/ajay\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"DataFrames in Julia - machinelearningplus","description":"DataFrames is a package in Julia which is widely used in data-intensive fields like data science, data analytics, scientific computing etc.","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:\/\/localhost:8080\/julia\/dataframes-in-julia\/","og_locale":"en_US","og_type":"article","og_title":"DataFrames in Julia - machinelearningplus","og_description":"DataFrames is a package in Julia which is widely used in data-intensive fields like data science, data analytics, scientific computing etc.","og_url":"https:\/\/localhost:8080\/julia\/dataframes-in-julia\/","og_site_name":"machinelearningplus","article_published_time":"2020-04-30T03:54:21+00:00","article_modified_time":"2022-03-08T16:41:11+00:00","og_image":[{"width":1200,"height":776,"url":"https:\/\/localhost:8080\/wp-content\/uploads\/2020\/04\/Julia_Programming_Language-min.png","type":"image\/png"}],"author":"Kabir","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Kabir","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/localhost:8080\/julia\/dataframes-in-julia\/#article","isPartOf":{"@id":"https:\/\/localhost:8080\/julia\/dataframes-in-julia\/"},"author":{"name":"Kabir","@id":"https:\/\/machinelearningplus.com\/#\/schema\/person\/01b9d7b59990cde0e05068914456b5ad"},"headline":"DataFrames in Julia","datePublished":"2020-04-30T03:54:21+00:00","dateModified":"2022-03-08T16:41:11+00:00","mainEntityOfPage":{"@id":"https:\/\/localhost:8080\/julia\/dataframes-in-julia\/"},"wordCount":919,"commentCount":0,"publisher":{"@id":"https:\/\/machinelearningplus.com\/#organization"},"image":{"@id":"https:\/\/localhost:8080\/julia\/dataframes-in-julia\/#primaryimage"},"thumbnailUrl":"https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/Julia_Programming_Language-min.png","keywords":["Data Manipulation","DataFrame","Julia","Julia Packages","Machine Learning"],"articleSection":["Julia"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/localhost:8080\/julia\/dataframes-in-julia\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/localhost:8080\/julia\/dataframes-in-julia\/","url":"https:\/\/localhost:8080\/julia\/dataframes-in-julia\/","name":"DataFrames in Julia - machinelearningplus","isPartOf":{"@id":"https:\/\/machinelearningplus.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/localhost:8080\/julia\/dataframes-in-julia\/#primaryimage"},"image":{"@id":"https:\/\/localhost:8080\/julia\/dataframes-in-julia\/#primaryimage"},"thumbnailUrl":"https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/Julia_Programming_Language-min.png","datePublished":"2020-04-30T03:54:21+00:00","dateModified":"2022-03-08T16:41:11+00:00","description":"DataFrames is a package in Julia which is widely used in data-intensive fields like data science, data analytics, scientific computing etc.","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/localhost:8080\/julia\/dataframes-in-julia\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/localhost:8080\/julia\/dataframes-in-julia\/#primaryimage","url":"https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/Julia_Programming_Language-min.png","contentUrl":"https:\/\/machinelearningplus.com\/wp-content\/uploads\/2020\/04\/Julia_Programming_Language-min.png","width":1200,"height":776,"caption":"Julian Programming Language"},{"@type":"WebSite","@id":"https:\/\/machinelearningplus.com\/#website","url":"https:\/\/machinelearningplus.com\/","name":"machinelearningplus","description":"Learn Data Science (AI \/ ML) Online","publisher":{"@id":"https:\/\/machinelearningplus.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/machinelearningplus.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/machinelearningplus.com\/#organization","name":"machinelearningplus","url":"https:\/\/machinelearningplus.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/machinelearningplus.com\/#\/schema\/logo\/image\/","url":"https:\/\/machinelearningplus.com\/wp-content\/uploads\/2022\/05\/MachineLearningplus-logo.svg","contentUrl":"https:\/\/machinelearningplus.com\/wp-content\/uploads\/2022\/05\/MachineLearningplus-logo.svg","width":348,"height":36,"caption":"machinelearningplus"},"image":{"@id":"https:\/\/machinelearningplus.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/machinelearningplus.com\/#\/schema\/person\/01b9d7b59990cde0e05068914456b5ad","name":"Kabir","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/machinelearningplus.com\/wp-content\/litespeed\/avatar\/5146322f528131e2446a7a18ab6020aa.jpg?ver=1783629629","url":"https:\/\/machinelearningplus.com\/wp-content\/litespeed\/avatar\/5146322f528131e2446a7a18ab6020aa.jpg?ver=1783629629","contentUrl":"https:\/\/machinelearningplus.com\/wp-content\/litespeed\/avatar\/5146322f528131e2446a7a18ab6020aa.jpg?ver=1783629629","caption":"Kabir"},"url":"https:\/\/machinelearningplus.com\/author\/ajay\/"}]}},"_links":{"self":[{"href":"https:\/\/machinelearningplus.com\/wp-json\/wp\/v2\/posts\/2999","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/machinelearningplus.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/machinelearningplus.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/machinelearningplus.com\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/machinelearningplus.com\/wp-json\/wp\/v2\/comments?post=2999"}],"version-history":[{"count":0,"href":"https:\/\/machinelearningplus.com\/wp-json\/wp\/v2\/posts\/2999\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/machinelearningplus.com\/wp-json\/wp\/v2\/media\/2825"}],"wp:attachment":[{"href":"https:\/\/machinelearningplus.com\/wp-json\/wp\/v2\/media?parent=2999"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/machinelearningplus.com\/wp-json\/wp\/v2\/categories?post=2999"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/machinelearningplus.com\/wp-json\/wp\/v2\/tags?post=2999"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}