How to Create and Use DataFrame in Julia

How to Create and Use DataFrame in Julia

In this short tutorial, I will show you how to create and use DataFrame in Julia on Windows.

Here are some past articles which are useful to create and use DataFrame in Julia.

How to Install Julia Language on Windows 10
A beginner guide to how Julia is installed on Windows 10.

How to Connect Julia to Jupyter Notebook on Windows
This article helps you to connect Julia to Jupyter notebook on your local windows machine.

How to Import and Use CSV file into Julia on Windows
You can import the CSV file into Julia for Exploratory Data Analysis.

What is DataFrame in Julia

A DataFrame in Julia is a data structure like a table. This package lets you store and visualize the related data values. Basically, it is an alternative to Python’s Pandas package.

However, you can use it in pandas using pandas.jl wrapper.
Alternatively, you can think of it as simply a table.

Prerequisites: To Create and Use DataFrame in Julia on Windows

You install Julia and Jupyter Notebook on your machine. I prefer using Anacoda distribution as it is easy to use.

Lets get started.

In this guide, we will use Jupyter Notebook and Julia.

Follow the steps below to create and use DataFrame in Julia.

Step 1

All you need to do is install Julia and Jupyter notebook. Once you complete the installation, then connect Julia to the notebook.

Step 2

Let us import the required packages.
Type the code in a notebook to install DataFrames packages and then press Run.

Adding DataFrames Package to create and use DataFrame in Julia on windows
Adding DataFrames Package

It will take a couple of minutes to execute.

Step 3

You can construct some datasets from scratch yourselves. Now, create the DataFrame using the following code.

Create Dataframe in Julia on windows
DataFrame

In addition, you can create DataFrame by providing the information about rows, and column names:

create DataFrame by providing the information about rows, and column names
DataFrame Creation



If you want to add data from the CSV file then select all the data and copy it to clipboard. Subsequently, copy the same using “ctrl+c” on windows. I selected the excerpt from the iris flower dataset.

Excerpt from Iris dataset
CSV file

Once you copy the data, then type the source code below. You will see the following DataFrame.

Dataframe created from clipboard
DataFrame from Clipboard


Leave a Comment