<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Erik Marsja</title>
    <description>The latest articles on DEV Community by Erik Marsja (@marsja).</description>
    <link>https://dev.to/marsja</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F117591%2F7a3ec8d8-7847-4172-ac7d-c46b1c3fa8f3.jpg</url>
      <title>DEV Community: Erik Marsja</title>
      <link>https://dev.to/marsja</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/marsja"/>
    <language>en</language>
    <item>
      <title>Mastering Data Manipulation: Merge Datasets in R</title>
      <dc:creator>Erik Marsja</dc:creator>
      <pubDate>Wed, 02 Aug 2023 11:36:40 +0000</pubDate>
      <link>https://dev.to/marsja/mastering-data-manipulation-merge-datasets-in-r-34kd</link>
      <guid>https://dev.to/marsja/mastering-data-manipulation-merge-datasets-in-r-34kd</guid>
      <description>&lt;p&gt;Combining datasets is an essential task in data science that empowers analysts to open valuable understandings and drive data-driven decision-making. The process of merging datasets allows analysts to consolidate information from numerous sources into a unified and comprehensive view, providing a deeper understanding of complex relationships and patterns within the data. In this R tutorial, we will get into merging datasets in R, providing you with essential skills to harness the full potential of your data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Requirements
&lt;/h2&gt;

&lt;p&gt;Before starting, ensure you have the necessary knowledge and packages. Basic familiarity with R programming is assumed, including understanding data frames and common &lt;a href="https://online.hbs.edu/blog/post/data-wrangling"&gt;data manipulation&lt;/a&gt; functions in &lt;a href="https://cran.r-project.org/"&gt;R&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This tutorial will use R, a powerful open-source programming language and environment for statistical computing and data analysis. Additionally, we will primarily rely on two essential R packages: dplyr and readxl. Dplyr offers an intuitive grammar for data manipulation, enabling smooth and efficient data transformation. Meanwhile, readxl focuses on reading Excel files.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reading Excel Files
&lt;/h2&gt;

&lt;p&gt;Here we read two &lt;a href="https://www.marsja.se/r-excel-tutorial-how-to-read-and-write-xlsx-files-in-r/"&gt;.xlsx files in R&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Load the required library
library(readxl)

# Read the student data from the .xlsx file
student_data &amp;lt;- read_excel("student_data.xlsx")

# Read the course data from the .xlsx file
course_data &amp;lt;- read_excel("course_data.xlsx")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After executing the above code, the "student_data" and "course_data" data frames will contain the data from the respective .xlsx files. You can merge these datasets in R using various methods, explore relationships between students and courses, and conduct insightful data analyses. &lt;/p&gt;

&lt;h2&gt;
  
  
  Merge Datasets in R Example 1: Inner Join
&lt;/h2&gt;

&lt;p&gt;In this example, we will perform an inner join between the "student_data" and "course_data" datasets based on the common CourseID. The inner join will only merge data in R with students taking courses and exclude those not enrolled in any course.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Load dplyr
library(dplyr)

# Perform an inner join
inner_merged_data &amp;lt;- inner_join(student_data, 
                                course_data, by = "CourseID")

# Display the merged dataset
print(inner_merged_data)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After executing the above code and merging the two datasets in R, the "student_data" and "course_data" data frames will contain the data from the respective .xlsx files. You can now explore various methods to merge these datasets, identify relationships between students and courses, and conduct insightful data analyses. &lt;/p&gt;

&lt;h2&gt;
  
  
  Merge Datasets in R Example 2: Left Join
&lt;/h2&gt;

&lt;p&gt;In this example, we will perform a left join between the "student_data" and "course_data" datasets based on the common CourseID. The left join will merge data in R from the "student_data" DataFrame with all available courses from the "course_data" DataFrame, including students not enrolled in any course.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Perform a left join
left_merged_data &amp;lt;- left_join(student_data,
                              course_data, by = "CourseID")

# Display the merged dataset
print(left_merged_data)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After running the code, we utilize the left_join() function from the dplyr package to merge the "student_data" and "course_data" datasets based on the common "CourseID" column. The resulting "left_merged_data" data frame includes all rows from the "student_data" DataFrame, irrespective of course enrollment. The corresponding columns from the "course_data" DataFrame will have NA values for students not enrolled in any course. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KIziSVjV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y6yuxr6rgswsjb5oauo6.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KIziSVjV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y6yuxr6rgswsjb5oauo6.jpg" alt="Merged datasets." width="800" height="365"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There is also a function for merging datasets called right_join() in the dplyr package. The right_join() function works similarly to left_join(), but it retains all rows from the right dataset and includes matching rows from the left dataset based on the common column. This provides a perspective where the focus is on the right dataset, and it incorporates relevant information from the left dataset, even for cases where no matches exist in the left dataset.&lt;/p&gt;

&lt;h2&gt;
  
  
  Example 3: Filtered Merge using %in%
&lt;/h2&gt;

&lt;p&gt;To merge the datasets using &lt;a href="https://www.marsja.se/how-to-use-in-in-r/"&gt;%in% in R&lt;/a&gt;, we will perform a filtered merge that includes only the students taking the course with CourseID 201 and the corresponding Instructor teaching that course.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Filter students taking course 201
students_taking_course_201 &amp;lt;- student_data %&amp;gt;%
  filter(CourseID %in% 201)

# Filter the course with CourseID 201 and its Instructor
course_201_info &amp;lt;- course_data %&amp;gt;%
  filter(CourseID %in% 201)

# Merge the filtered datasets
merged_data &amp;lt;- inner_join(students_taking_course_201, 
                          course_201_info, by = "CourseID")

# Display the merged dataset
print(merged_data)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After executing the code, we filter the students taking the course with CourseID 201 from the "student_data" DataFrame using the %in% operator. Simultaneously, we filter the course with CourseID 201 and its Instructor from the "course_data" DataFrame. Next, we perform an inner join on the filtered datasets based on the common "CourseID" column. This results in the merged dataset containing only the students taking Course 201 and the corresponding Instructor teaching that course. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JFOwscMU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eolgtew8y2n9db7txvir.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JFOwscMU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eolgtew8y2n9db7txvir.jpg" alt="Filtered and merged datasets." width="800" height="116"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this post, we explored how to merge datasets in R using various functions from the dplyr package, such as left_join() and right_join(). We learned how to perform inner joins and utilize %in% to filter and merge specific data based on common columns. &lt;/p&gt;

</description>
      <category>r</category>
      <category>rstats</category>
      <category>datawrangling</category>
      <category>datascience</category>
    </item>
    <item>
      <title>Data Wrangling in Python and Pandas: to Process and Prepare Data for Analysis</title>
      <dc:creator>Erik Marsja</dc:creator>
      <pubDate>Thu, 20 Aug 2020 19:40:10 +0000</pubDate>
      <link>https://dev.to/marsja/data-wrangling-in-python-and-pandas-to-process-and-prepare-data-for-analysis-45dk</link>
      <guid>https://dev.to/marsja/data-wrangling-in-python-and-pandas-to-process-and-prepare-data-for-analysis-45dk</guid>
      <description>&lt;p&gt;In this post, I will cover some basic data wrangling techniques that we can do with Python and Pandas. Actually, here I will also introduce the excellent Python package dfply. &lt;/p&gt;

&lt;h2&gt;
  
  
  What is data wrangling and why is it an important technique to know in Python?
&lt;/h2&gt;

&lt;p&gt;Processing of data is known as data wrangling, data munging, data, grunging, or data preparation processes. The purpose of the processing of the data is to format the information so that it can be analyzed later. This step is extremely important because the majority of the working hours usually are spent in order to process the data. Often, the majority of the analysis code (e.g., in Python) will be concerned with data munging, which processes the data. It is, therefore, extremely important to learn this in an efficient and robust way. To select the rows and columns of the data without a doubt two of the most basic of tasks. Furthermore, to add new variables (e.g., columns to Pandas dataframe), or modifying variables are also examples of two essential tasks.&lt;br&gt;
Thus, it is important to learn from, for example, &lt;a href="https://www.marsja.se"&gt;R and Python tutorials&lt;/a&gt;, and, &lt;a href="https://www.fullstackpython.com/pandas.html"&gt;Pandas tutorials&lt;/a&gt;, like this one.&lt;/p&gt;

&lt;p&gt;Today, there are all the necessary functions to process the data. Unfortunately, however, these features are often difficult to use or results in code that is difficult to read. Developers, and data scientists, in the R community, took note of this early on and came up with several libraries, to carry out data wrangling. One of my favorite libraries is undoubtedly dplyr, part of the tidyverse library, and dplyr has maybe been the most revolutionary of the libraries, as it has introduced in a completely new way to manipulate data. In the dplyr, simplicity is in focus; with a small number of functions, some of which are simple and easy to use, enables powerful processing of data. The Python community has observed that dplyr became very popular, and because of this, there are equivalent Pyton packages. In fact, there are three packages for Python: dfply, pandas-ply, and plython. In this post, I will exemplify how powerful, and easy, one of these packages are; &lt;a href="https://github.com/kieferk/dfply"&gt;dfply&lt;/a&gt;. This, I would say, makes Pandas (and dfply) one of the &lt;a href="https://dev.to/marsja/essential-python-libraries-for-data-science-machine-learning-and-statistics-5175"&gt;essential Python packages for data science&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  Installing Python Packages
&lt;/h2&gt;

&lt;p&gt;In case you need to install Pandas and dfply, here's how to get them installed using pip:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;pip install pandas dfply&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Importing Data in Python with Pandas
&lt;/h2&gt;

&lt;p&gt;Now, before we go on and have a look at how to munge data with Python we need some example data. Here, you will import a dataset (from a .csv file) from a URL:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;pandas&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;

&lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;read_csv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'https://vincentarelbundock.github.io/Rdatasets/csv/Ecdat/Earnings.csv'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="n"&gt;index_col&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Checking the first five rows of the dataset can be done using the head() method:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WA1oEFdG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/mnrkdrefsehc5r645yf3.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WA1oEFdG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/mnrkdrefsehc5r645yf3.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Data wrangling in Python with Pandas and dfply
&lt;/h2&gt;

&lt;p&gt;In this section, you are going to learn &lt;a href="https://www.marsja.se/renaming-columns-in-pandas-dataframe/"&gt;how to rename columns in Pandas dataframe&lt;/a&gt; with dfply. After this, you are going to learn how to calculate simple descriptive statistics. &lt;/p&gt;
&lt;h3&gt;
  
  
  Changing Column Names in Pandas Dataframe with dlfply
&lt;/h3&gt;

&lt;p&gt;Here's how easy it is to change the column names in the dataframe. First, we import dlfply:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;dlfply&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This is was done through the use of the function from, followed by a *, which will activate all of the functions available in the Python library, and we don't have to write "dfply." in front of each and every function that we want to use.&lt;/p&gt;

&lt;p&gt;Second, we use piping, and the rename() method:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;rename&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Wage&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;'y'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;Age&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;'age'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Hm_0juOU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/6wpd5eecnfkrk2nvmd12.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Hm_0juOU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/6wpd5eecnfkrk2nvmd12.JPG" alt="Pandas dataframe with renamed columns"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Note, how we used &amp;gt;&amp;gt; in order to create a chain of events. The real power with this, may not be evident in the simple example code above. However, using this method enables us to carry out a lot of data wrangling tasks in a single line of code. &lt;/p&gt;

&lt;h3&gt;
  
  
  Summary statistics in Python with dlfply (and Pandas)
&lt;/h3&gt;

&lt;p&gt;Here's how easy it is to calculate descriptive statistics (by groups) with dlfply:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;group_by&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;'Age'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;summarize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mean&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;X&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Wage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;mean&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
                                   &lt;span class="n"&gt;meadian&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;X&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Wage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;median&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
                                  &lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;X&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Wage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;std&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JnLKZAkp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/m71rlnv9ffzvrmsjrdkj.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JnLKZAkp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/m71rlnv9ffzvrmsjrdkj.JPG" alt="Descriptive Statistics"&gt;&lt;/a&gt;&lt;br&gt;
Again, the code begins with a "df &amp;gt;&amp;gt; group_by('Age'), which is interpreted as ”the start with df, then group df by Age group”. This means that the following functions will be carried out on Age groups (from the column). Then, we proceed to summarize(mean=X.Wage.mean(), which implies that we describe that; including mean, the median, and the standard deviation of Wage. Please note that we do use X to tell Python that Wage is derived from the same dataframe we started off with (df).&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/_Um3vVZQMok"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Hope you learned something, please share if you did!&lt;/p&gt;

</description>
      <category>python</category>
      <category>pandas</category>
      <category>r</category>
      <category>datascience</category>
    </item>
    <item>
      <title>Essential Python Libraries for Data Science, Machine Learning, and Statistics</title>
      <dc:creator>Erik Marsja</dc:creator>
      <pubDate>Sun, 25 Nov 2018 11:48:57 +0000</pubDate>
      <link>https://dev.to/marsja/essential-python-libraries-for-data-science-machine-learning-and-statistics-5175</link>
      <guid>https://dev.to/marsja/essential-python-libraries-for-data-science-machine-learning-and-statistics-5175</guid>
      <description>&lt;p&gt;In this post I will list some very valuable libraries for people who intend to use Python for data science, Machine Learning, and Statistics. These libraries are very extensive and are developed by a big number of experts around the world and together, the libraries, make Python a very powerful tool for data analysis. &lt;/p&gt;

&lt;p&gt;I really recommend that you install, and use, Anaconda the scientific Python distribution. This will give you loads of Python libraries installed. In the example below we will use one very handy library; Pandas. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy6y7c67n7kyuk8udld7o.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fy6y7c67n7kyuk8udld7o.JPG" alt="How to import and use Pandas"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The convention is to load pandas as pd and then we can use the methods and classes very easily. For instance, we can write pd.read_csv(‘datafile.csv’) to load a CSV file to a dataframe object.&lt;/p&gt;

&lt;h2&gt;
  
  
  Essential Libraries in Python
&lt;/h2&gt;

&lt;p&gt;In this section I will list some of the most essential Python libraries when it comes to data science.&lt;/p&gt;

&lt;h3&gt;
  
  
  NumPy (Numerical Python)
&lt;/h3&gt;

&lt;p&gt;NumPy is an extensive library for data storage and calculations. This library contains data structures, algorithms, and other things that are used to handle numerical data in Python. Furthermore, NumPy includes methods for arrays (lists) that are more efficient than Python's built-in methods. This makes NumPy faster than Python's standard methods. NumPy also contains features that can be used to load data to Python, as well as export data from Python.&lt;/p&gt;

&lt;p&gt;If you are migrating from MATLAB, for instance, you will like NumPy (see &lt;a href="https://docs.scipy.org/doc/numpy-1.15.0/user/numpy-for-matlab-users.html" rel="noopener noreferrer"&gt;here&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;&lt;a href="http://numpy.org" rel="noopener noreferrer"&gt;http://numpy.org&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Pandas
&lt;/h3&gt;

&lt;p&gt;Pandas is the most powerful library for data manipulation. Pandas contains a wide range of data import and export functions, as well as for indexing and manipulating data. This library is inevitable for those who use the Python for data science. Pandas also includes sophisticated methods for data structures. The most used data structure in pandas is dataframe (series of columns and rows) and series (a 1-dimensional array).&lt;/p&gt;

&lt;p&gt;Pandas are extremely effective for reshaping, merging, splitting, aggregating, and selecting (subsetting) data. In fact, the absolute majority of the code in a data science project usually consists of data wrangling, which are the steps required to prepare data so that analyses can be performed. Having a coherent library for all data wrangling is, of course, advantageous. &lt;br&gt;
Unlike the statistical programming environment konwn as R, there is no built-in variant of dataframes in Python. Dataframes are central to basically all data analysis. A dataframe is a table of columns and rows. &lt;a href="https://www.marsja.se/pandas-dataframe-read-csv-excel-subset/" rel="noopener noreferrer"&gt;Here's&lt;/a&gt; a very nice Pandas Dataframe tutorial I wrote, aimed at the beginner.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://pandas.pydata.org" rel="noopener noreferrer"&gt;http://pandas.pydata.org&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  matplotlib
&lt;/h3&gt;

&lt;p&gt;Matplotlib is used to visualize data.  Although matplotlib is quite easy to use and you have a lot of control over your plots I would recommend using Seaborn.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://matplotlib.org" rel="noopener noreferrer"&gt;http://matplotlib.org&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Seaborn
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://seaborn.pydata.org/" rel="noopener noreferrer"&gt;Seaborn&lt;/a&gt; is Python package for data visualization that is based on matplotlib. This package gives us a high-level interface for drawing beautiful and informative visualizations. It's possible to draw bar plots, histograms, scatter plots, and many other nice plots.&lt;/p&gt;

&lt;p&gt;Here's an example using NumPy to generate some data and plotting it using Seaborn:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;numpy&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;seaborn&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;sns&lt;/span&gt;

&lt;span class="c1"&gt;# Generate some normally distributed data
&lt;/span&gt;&lt;span class="n"&gt;dat&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;random&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;normal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;0.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Create a histogram using seaborn
&lt;/span&gt;&lt;span class="n"&gt;sns&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;distplot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dat&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqxbq7z3zitbicz4dasn7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqxbq7z3zitbicz4dasn7.png" alt="Histogram created with Seaborn"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.marsja.se/how-to-make-a-scatter-plot-in-python-using-seaborn/" rel="noopener noreferrer"&gt;Learn how to create scatter plot in Python using Seaborn&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  SciPy (Scientific Python)
&lt;/h3&gt;

&lt;p&gt;SciPy includes features for advanced calculations.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://scipy.org" rel="noopener noreferrer"&gt;http://scipy.org&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  scikit-learn
&lt;/h3&gt;

&lt;p&gt;scikit-learn is a huge library of data analysis features. In scikit-learning there are classification models (e.g., Support Vector Machines, random forest), regression analysis (linear regression, ridge regression, lasso), cluster analysis (e.g, k-means clustering), data reduction methods (e.g., Principal Component Analysis,, feature selection), model tuning and selection (with features like grid search, cross validation, etc), pre-processing of data among many other things.&lt;br&gt;
&lt;a href="http://scikit-learn.org/" rel="noopener noreferrer"&gt;http://scikit-learn.org/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>datascience</category>
      <category>statistics</category>
      <category>machinelearning</category>
    </item>
  </channel>
</rss>
