<?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: Kebee crc</title>
    <description>The latest articles on DEV Community by Kebee crc (@cromajetex).</description>
    <link>https://dev.to/cromajetex</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%2F920520%2F29bc8dee-60c2-4e11-9514-a681f9d3a904.png</url>
      <title>DEV Community: Kebee crc</title>
      <link>https://dev.to/cromajetex</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/cromajetex"/>
    <language>en</language>
    <item>
      <title>manipulation Data Science</title>
      <dc:creator>Kebee crc</dc:creator>
      <pubDate>Sun, 05 Mar 2023 22:44:11 +0000</pubDate>
      <link>https://dev.to/cromajetex/manipulation-data-science-3h48</link>
      <guid>https://dev.to/cromajetex/manipulation-data-science-3h48</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  Welcome to Data Science
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ibKdgJ-w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jrn9phfxnec6iqgd7nmv.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ibKdgJ-w--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jrn9phfxnec6iqgd7nmv.jpeg" alt="Image description" width="678" height="452"&gt;&lt;/a&gt;&lt;br&gt;
Congratulations on taking a big step toward becoming a data scientist!&lt;br&gt;
In addition to working through this course, be sure to take advantage of all of the learning support available to you on SoloLearn, including the daily tips, Try it Yourself practices, code coach challenges, code playground, and engagement with our amazing learner community. We love to hear from you, so please leave comments and feedback as you learn with us or chart us at &lt;a href="mailto:cromajet1@gmail.com"&gt;cromajet1@gmail.com&lt;/a&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  What is Data Science?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;There are many use cases in business for data science including finding a better housing price prediction algorithm for Zillow, finding key attributes associated with wine quality, and building a recommendation system to increase the click-through-rate for Amazon.&lt;br&gt;
Extracting insights from seemingly random data, data science normally involves collecting data, cleaning data, performing exploratory data analysis, building and evaluating machine learning models, and communicating insights to stakeholders.&lt;/p&gt;

&lt;p&gt;Also Data science is a multidisciplinary field that unifies statistics, data analysis, machine learning and their related methods to extract knowledge and insights.&lt;/p&gt;

&lt;p&gt;In this Introduction to Data Science course we’re learning data science with Python. As a general-purpose programming language, Python is now the most popular programming language in data science. It’s easy to use, has great community support, and integrates well with other frameworks (e.g., web applications) in an engineering environment.&lt;/p&gt;

&lt;p&gt;This course focuses on exploratory data analysis with three fundamental Python libraries: numpy, pandas and matplotlib. The machine learning library scikit-learn will be covered as well.&lt;br&gt;
In the later modules, we will be predicting home values using linear regression, identifying classes of iris with classification algorithms, and finding clusters within wines, just a few examples of what we can do in data science.&lt;br&gt;
Also In data science, there are other popular programming languages, such as R, which has an edge in statistical modeling.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;      Numerical Data
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Datasets come from a wide range of sources and formats: it could be collections of numerical measurements, text corpus, images, audio clips, or basically anything. No matter the format, the first step in data science is to transform it into arrays of numbers.&lt;/p&gt;

&lt;p&gt;We collected 45 U.S. president heights in centimeters in chronological order and stored them in a list, a built-in data type in python.&lt;br&gt;
heights = [189, 170, 189, 163, 183, 171, 185, 168, 173, 183, 173, 173, 175, 178, 183, 193, 178, 173, 174, 183, 183, 180, 168, 180, 170, 178, 182, 180, 183, 178, 182, 188, 175, 179, 183, 193, 182, 183, 177, 185, 188, 188, 182, 185, 191]&lt;br&gt;
In this example, George Washington was the first president, and his height was 189 cm.&lt;/p&gt;

&lt;p&gt;If we wanted to know how many presidents are taller than 188cm, we could iterate through the list, compare each element against 188, and increase the count by 1 as the criteria is met.&lt;br&gt;
heights = [189, 170, 189, 163, 183, 171, 185, 168, 173, 183, 173, 173, 175, 178, 183, 193, 178, 173, 174, 183, 183, 180, 168, 180, 170, 178, 182, 180, 183, 178, 182, 188, 175, 179, 183, 193, 182, 183, 177, 185, 188, 188, 182, 185, 191]&lt;/p&gt;

&lt;p&gt;cnt = 0&lt;br&gt;
for height in heights:&lt;br&gt;
    if height &amp;gt; 188:&lt;br&gt;
        cnt +=1&lt;br&gt;
print(cnt)&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;            Introduction to Numpy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Numpy (short for Numerical Python) allows us to find the answer to how many presidents are taller than 188cm with ease. Below we show how to use the library and start with the basic object in numpy.&lt;br&gt;
import numpy as np&lt;/p&gt;

&lt;p&gt;heights = [189, 170, 189, 163, 183, 171, 185, 168, 173, 183, 173, 173, 175, 178, 183, 193, 178, 173, 174, 183, 183, 180, 168, 180, 170, 178, 182, 180, 183, 178, 182, 188, 175, 179, 183, 193, 182, 183, 177, 185, 188, 188, 182, 185, 191]&lt;/p&gt;

&lt;p&gt;heights_arr = np.array(heights)&lt;br&gt;
print((heights_arr &amp;gt; 188).sum())&lt;/p&gt;

&lt;p&gt;The import statement allows us to access the functions and modules inside the numpy library. The library will be used frequently, so by convention numpy is imported under a shorter name, np. The second line is to convert the list into a numpy array object, via np.array(), that tools provided in numpy can work with. The last line provides a simple and natural solution, enabled by numpy, to the original question.&lt;/p&gt;

&lt;p&gt;As our datasets grow larger and more complicated, numpy allows us the use of a more efficient and for-loop-free method to manipulate and analyze our data. Our dataset example in this module will include the US Presidents' height, age and party.&lt;/p&gt;

&lt;p&gt;Note&lt;br&gt;
Python modules can get access to code from another module by importing the file/function using the import statement.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                Size and Shape
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;An array class in Numpy is called an ndarray or n-dimensional array. We can use this to count the number of presidents in heights_arr, use attribute numpy.ndarray.size:&lt;br&gt;
import numpy as np&lt;/p&gt;

&lt;p&gt;heights = [189, 170, 189, 163, 183, 171, 185, 168, 173, 183, 173, 173, 175, 178, 183, 193, 178, 173, 174, 183, 183, 180, 168, 180, 170, 178, 182, 180, 183, 178, 182, 188, 175, 179, 183, 193, 182, 183, 177, 185, 188, 188, 182, 185, 191]&lt;/p&gt;

&lt;p&gt;heights_arr = np.array(heights)&lt;br&gt;
print(heights_arr.size)&lt;/p&gt;

&lt;p&gt;Note that once an array is created in numpy, its size cannot be changed.&lt;/p&gt;

&lt;p&gt;Size tells us how big the array is, shape tells us the dimension. To get current shape of an array use attribute shape:&lt;br&gt;
import numpy as np&lt;/p&gt;

&lt;p&gt;heights = [189, 170, 189, 163, 183, 171, 185, 168, 173, 183, 173, 173, 175, 178, 183, 193, 178, 173, 174, 183, 183, 180, 168, 180, 170, 178, 182, 180, 183, 178, 182, 188, 175, 179, 183, 193, 182, 183, 177, 185, 188, 188, 182, 185, 191]&lt;/p&gt;

&lt;p&gt;heights_arr = np.array(heights)&lt;br&gt;
print(heights_arr.shape)&lt;/p&gt;

&lt;p&gt;The output is a tuple, recall that the built-in data type tuple is immutable whereas a list is mutable, containing a single value, indicating that there is only one dimension, i.e., axis 0. Along axis 0, there are 45 elements (one for each president) Here, heights_arr is a 1d array.&lt;/p&gt;

&lt;p&gt;NOTE:Attribute size in numpy is similar to the built-in method len in python that is used to compute the length of iterable python objects like str, list, dict, etc.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                 Reshape
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Other data we have collected includes the ages of the presidents:&lt;/p&gt;

&lt;p&gt;ages = [57, 61, 57, 57, 58, 57, 61, 54, 68, 51, 49, 64, 50, 48, 65, 52, 56, 46, 54, 49, 51, 47, 55, 55, 54, 42, 51, 56, 55, 51, 54, 51, 60, 62, 43, 55, 56, 61, 52, 69, 64, 46, 54, 47, 70]&lt;/p&gt;

&lt;p&gt;Since both heights and ages are all about the same presidents, we can combine them:&lt;/p&gt;

&lt;p&gt;import numpy as np&lt;/p&gt;

&lt;p&gt;heights = [189, 170, 189, 163, 183, 171, 185, 168, 173, 183, 173, 173, 175, 178, 183, 193, 178, 173, 174, 183, 183, 180, 168, 180, 170, 178, 182, 180, 183, 178, 182, 188, 175, 179, 183, 193, 182, 183, 177, 185, 188, 188, 182, 185, 191]&lt;/p&gt;

&lt;p&gt;ages = [57, 61, 57, 57, 58, 57, 61, 54, 68, 51, 49, 64, 50, 48, 65, 52, 56, 46, 54, 49, 51, 47, 55, 55, 54, 42, 51, 56, 55, 51, 54, 51, 60, 62, 43, 55, 56, 61, 52, 69, 64, 46, 54, 47, 70]&lt;/p&gt;

&lt;p&gt;heights_and_ages = heights + ages &lt;/p&gt;

&lt;h1&gt;
  
  
  convert a list to a numpy array
&lt;/h1&gt;

&lt;p&gt;heights_and_ages_arr = np.array(heights_and_ages)&lt;br&gt;
print(heights_and_ages_arr.shape)&lt;/p&gt;

&lt;p&gt;This produces one long array. It would be clearer if we could align height and age for each president and reorganize the data into a 2 by 45 matrix where the first row contains all heights and the second row contains ages. To achieve this, a new array can be created by calling numpy.ndarray.reshape with new dimensions specified in a tuple:&lt;/p&gt;

&lt;p&gt;import numpy as np&lt;/p&gt;

&lt;p&gt;heights = [189, 170, 189, 163, 183, 171, 185, 168, 173, 183, 173, 173, 175, 178, 183, 193, 178, 173, 174, 183, 183, 180, 168, 180, 170, 178, 182, 180, 183, 178, 182, 188, 175, 179, 183, 193, 182, 183, 177, 185, 188, 188, 182, 185, 191]&lt;/p&gt;

&lt;p&gt;ages = [57, 61, 57, 57, 58, 57, 61, 54, 68, 51, 49, 64, 50, 48, 65, 52, 56, 46, 54, 49, 51, 47, 55, 55, 54, 42, 51, 56, 55, 51, 54, 51, 60, 62, 43, 55, 56, 61, 52, 69, 64, 46, 54, 47, 70]&lt;/p&gt;

&lt;p&gt;heights_and_ages = heights + ages &lt;/p&gt;

&lt;h1&gt;
  
  
  convert a list to a numpy array
&lt;/h1&gt;

&lt;p&gt;heights_and_ages_arr = np.array(heights_and_ages)&lt;br&gt;
print(heights_and_ages_arr.reshape((2,45)))&lt;/p&gt;

&lt;p&gt;The reshaped array is now a 2darray, yet note that the original array is not changed. We can reshape an array in multiple ways, as long as the size of the reshaped array matches that of the original.&lt;/p&gt;

&lt;p&gt;Numpy can calculate the shape (dimension) for us if we indicate the unknown dimension as -1. For example, given a 2darray &lt;code&gt;arr&lt;/code&gt; of shape (3,4), arr.reshape(-1) would output a 1darray of shape (12,), while arr.reshape((-1,2)) would generate a 2darray of shape (6,2).&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;               Data Type
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Another characteristic about numpy array is that it is homogeneous, meaning each element must be of the same data type.&lt;/p&gt;

&lt;p&gt;For example, in heights_arr, we recorded all heights in whole numbers; thus each element is stored as an integer in the array. To check the data type, use numpy.ndarray.dtype&lt;/p&gt;

&lt;p&gt;import numpy as np&lt;/p&gt;

&lt;p&gt;heights = [189, 170, 189, 163, 183, 171, 185, 168, 173, 183, 173, 173, 175, 178, 183, 193, 178, 173, 174, 183, 183, 180, 168, 180, 170, 178, 182, 180, 183, 178, 182, 188, 175, 179, 183, 193, 182, 183, 177, 185, 188, 188, 182, 185, 191]&lt;/p&gt;

&lt;p&gt;heights_arr = np.array(heights)&lt;br&gt;
print(heights_arr.dtype)&lt;/p&gt;

&lt;p&gt;If we mixed a float number in, say, the first element is 189.0 instead of 189:&lt;/p&gt;

&lt;p&gt;heights_float = [189.0, 170, 189, 163, 183, 171, 185, 168, 173, 183, 173, 173, 175, 178, 183, 193, 178, 173, 174, 183, 183, 180, 168, 180, 170, 178, 182, 180, 183, 178, 182, 188, 175, 179, 183, 193, 182, 183, 177, 185, 188, 188, 182, 185, 191]&lt;/p&gt;

&lt;p&gt;Then after converting the list into an array, we’d see all other numbers are coerced into floats:&lt;/p&gt;

&lt;p&gt;import numpy as np&lt;/p&gt;

&lt;p&gt;heights_float = [189.0, 170, 189, 163, 183, 171, 185, 168, 173, 183, 173, 173, 175, 178, 183, 193, 178, 173, 174, 183, 183, 180, 168, 180, 170, 178, 182, 180, 183, 178, 182, 188, 175, 179, 183, 193, 182, 183, 177, 185, 188, 188, 182, 185, 191]&lt;/p&gt;

&lt;p&gt;heights_float_arr = np.array(heights_float)&lt;br&gt;
print(heights_float_arr)&lt;br&gt;
print("\n")&lt;br&gt;
print(heights_float_arr.dtype)&lt;/p&gt;

&lt;p&gt;Numpy supports several data types such as int (integer), float (numeric floating point), and bool (boolean values, True and False). The number after the data type, ex. int64, represents the bitsize of the data type.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                    Indexing
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;We can use array indexing to select individual elements from arrays. Like Python lists, numpy index starts from 0. &lt;/p&gt;

&lt;p&gt;To access the height of the 3rd president Thomas Jefferson in the 1darray 'heights_arr':&lt;/p&gt;

&lt;p&gt;import numpy as np&lt;/p&gt;

&lt;p&gt;heights = [189, 170, 189, 163, 183, 171, 185, 168, 173, 183, 173, 173, 175, 178, 183, 193, 178, 173, 174, 183, 183, 180, 168, 180, 170, 178, 182, 180, 183, 178, 182, 188, 175, 179, 183, 193, 182, 183, 177, 185, 188, 188, 182, 185, 191]&lt;/p&gt;

&lt;p&gt;heights_arr = np.array(heights)&lt;br&gt;
print(heights_arr[2])&lt;/p&gt;

&lt;p&gt;In a 2darray, there are two axes, axis 0 and 1. Axis 0 runs downward down the rows whereas axis 1 runs horizontally across the columns. &lt;/p&gt;

&lt;p&gt;In the 2darrary heights_and_ages_arr, recall that its dimensions are (2, 45). To find Thomas Jefferson’s age at the beginning of his presidency you would need to access the second row where ages are stored:&lt;/p&gt;

&lt;p&gt;import numpy as np&lt;/p&gt;

&lt;p&gt;heights = [189, 170, 189, 163, 183, 171, 185, 168, 173, 183, 173, 173, 175, 178, 183, 193, 178, 173, 174, 183, 183, 180, 168, 180, 170, 178, 182, 180, 183, 178, 182, 188, 175, 179, 183, 193, 182, 183, 177, 185, 188, 188, 182, 185, 191]&lt;/p&gt;

&lt;p&gt;ages = [57, 61, 57, 57, 58, 57, 61, 54, 68, 51, 49, 64, 50, 48, 65, 52, 56, 46, 54, 49, 51, 47, 55, 55, 54, 42, 51, 56, 55, 51, 54, 51, 60, 62, 43, 55, 56, 61, 52, 69, 64, 46, 54, 47, 70]&lt;/p&gt;

&lt;p&gt;heights_and_ages = heights + ages&lt;br&gt;
heights_and_ages_arr = np.array(heights_and_ages)&lt;br&gt;
heights_and_ages_arr = heights_and_ages_arr.reshape((2,45))&lt;br&gt;
print(heights_and_ages_arr[1,2])&lt;/p&gt;

&lt;p&gt;NOTE:In 2darray, the row is axis 0 and the column is axis 1, therefore, to access a 2darray, numpy first looks for the position in rows, then in columns. So in our example heights_and_ages_arr[1,2], we are accessing row 2 (ages), column 3 (third president) to find Thomas Jefferson’s age.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                    Slicing
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;What if we want to inspect the first three elements from the first row in a 2darray? We use ":" to select all the elements from the index up to but not including the ending index. This is called slicing.&lt;/p&gt;

&lt;p&gt;import numpy as np&lt;/p&gt;

&lt;p&gt;heights = [189, 170, 189, 163, 183, 171, 185, 168, 173, 183, 173, 173, 175, 178, 183, 193, 178, 173, 174, 183, 183, 180, 168, 180, 170, 178, 182, 180, 183, 178, 182, 188, 175, 179, 183, 193, 182, 183, 177, 185, 188, 188, 182, 185, 191]&lt;/p&gt;

&lt;p&gt;ages = [57, 61, 57, 57, 58, 57, 61, 54, 68, 51, 49, 64, 50, 48, 65, 52, 56, 46, 54, 49, 51, 47, 55, 55, 54, 42, 51, 56, 55, 51, 54, 51, 60, 62, 43, 55, 56, 61, 52, 69, 64, 46, 54, 47, 70]&lt;/p&gt;

&lt;p&gt;heights_and_ages = heights + ages&lt;br&gt;
heights_and_ages_arr = np.array(heights_and_ages)&lt;br&gt;
heights_and_ages_arr = heights_and_ages_arr.reshape((2,45))&lt;br&gt;
print(heights_and_ages_arr[0, 0:3])&lt;/p&gt;

&lt;p&gt;When the starting index is 0, we can omit it as shown below:&lt;/p&gt;

&lt;p&gt;When the starting index is 0, we can omit it as shown below:&lt;/p&gt;

&lt;p&gt;import numpy as np&lt;/p&gt;

&lt;p&gt;heights = [189, 170, 189, 163, 183, 171, 185, 168, 173, 183, 173, 173, 175, 178, 183, 193, 178, 173, 174, 183, 183, 180, 168, 180, 170, 178, 182, 180, 183, 178, 182, 188, 175, 179, 183, 193, 182, 183, 177, 185, 188, 188, 182, 185, 191]&lt;/p&gt;

&lt;p&gt;ages = [57, 61, 57, 57, 58, 57, 61, 54, 68, 51, 49, 64, 50, 48, 65, 52, 56, 46, 54, 49, 51, 47, 55, 55, 54, 42, 51, 56, 55, 51, 54, 51, 60, 62, 43, 55, 56, 61, 52, 69, 64, 46, 54, 47, 70]&lt;/p&gt;

&lt;p&gt;heights_and_ages = heights + ages&lt;br&gt;
heights_and_ages_arr = np.array(heights_and_ages)&lt;br&gt;
heights_and_ages_arr = heights_and_ages_arr.reshape((2,45))&lt;br&gt;
print(heights_and_ages_arr[0, :3])&lt;/p&gt;

&lt;p&gt;What if we’d like to see the entire fourth column? Specify this by using a ":" as follows&lt;/p&gt;

&lt;p&gt;import numpy as np&lt;/p&gt;

&lt;p&gt;heights = [189, 170, 189, 163, 183, 171, 185, 168, 173, 183, 173, 173, 175, 178, 183, 193, 178, 173, 174, 183, 183, 180, 168, 180, 170, 178, 182, 180, 183, 178, 182, 188, 175, 179, 183, 193, 182, 183, 177, 185, 188, 188, 182, 185, 191]&lt;/p&gt;

&lt;p&gt;ages = [57, 61, 57, 57, 58, 57, 61, 54, 68, 51, 49, 64, 50, 48, 65, 52, 56, 46, 54, 49, 51, 47, 55, 55, 54, 42, 51, 56, 55, 51, 54, 51, 60, 62, 43, 55, 56, 61, 52, 69, 64, 46, 54, 47, 70]&lt;/p&gt;

&lt;p&gt;heights_and_ages = heights + ages&lt;br&gt;
heights_and_ages_arr = np.array(heights_and_ages)&lt;br&gt;
heights_and_ages_arr = heights_and_ages_arr.reshape((2,45))&lt;br&gt;
print(heights_and_ages_arr[:, 3])&lt;/p&gt;

&lt;p&gt;Numpy slicing syntax follows that of a python list: arr[start:stop:step]. When any of these are unspecified, they default to the values start=0, stop=size of dimension, step=1.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;        Assigning Single Values
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Sometimes you need to change the values of particular elements in the array. For example, we noticed the fourth entry in the heights_arr was incorrect, it should be 165 instead of 163, we can re-assign the correct number by:&lt;/p&gt;

&lt;p&gt;import numpy as np&lt;/p&gt;

&lt;p&gt;heights = [189, 170, 189, 163, 183, 171, 185, 168, 173, 183, 173, 173, 175, 178, 183, 193, 178, 173, 174, 183, 183, 180, 168, 180, 170, 178, 182, 180, 183, 178, 182, 188, 175, 179, 183, 193, 182, 183, 177, 185, 188, 188, 182, 185, 191]&lt;/p&gt;

&lt;p&gt;heights_arr = np.array(heights)&lt;br&gt;
heights_arr[3] = 165&lt;br&gt;
print(heights_arr)&lt;/p&gt;

&lt;p&gt;In a 2darray, single values can be assigned easily. You can use indexing for one element. For example, change the fourth entry in heights_arr to 165:&lt;/p&gt;

&lt;p&gt;import numpy as np&lt;/p&gt;

&lt;p&gt;heights = [189, 170, 189, 163, 183, 171, 185, 168, 173, 183, 173, 173, 175, 178, 183, 193, 178, 173, 174, 183, 183, 180, 168, 180, 170, 178, 182, 180, 183, 178, 182, 188, 175, 179, 183, 193, 182, 183, 177, 185, 188, 188, 182, 185, 191]&lt;/p&gt;

&lt;p&gt;ages = [57, 61, 57, 57, 58, 57, 61, 54, 68, 51, 49, 64, 50, 48, 65, 52, 56, 46, 54, 49, 51, 47, 55, 55, 54, 42, 51, 56, 55, 51, 54, 51, 60, 62, 43, 55, 56, 61, 52, 69, 64, 46, 54, 47, 70]&lt;/p&gt;

&lt;p&gt;heights_and_ages = heights + ages &lt;br&gt;
heights_and_ages_arr = np.array(heights_and_ages)&lt;br&gt;
heights_and_ages_arr = heights_and_ages_arr.reshape((2,45))&lt;br&gt;
heights_and_ages_arr[0, 3] = 165&lt;br&gt;
print(heights_and_ages_arr)&lt;/p&gt;

&lt;p&gt;Or we can use slicing for multiple elements. For example, to replace the first row by its mean 180 in heights_and_ages_arr:&lt;/p&gt;

&lt;p&gt;numpy as np&lt;/p&gt;

&lt;p&gt;heights = [189, 170, 189, 163, 183, 171, 185, 168, 173, 183, 173, 173, 175, 178, 183, 193, 178, 173, 174, 183, 183, 180, 168, 180, 170, 178, 182, 180, 183, 178, 182, 188, 175, 179, 183, 193, 182, 183, 177, 185, 188, 188, 182, 185, 191]&lt;/p&gt;

&lt;p&gt;ages = [57, 61, 57, 57, 58, 57, 61, 54, 68, 51, 49, 64, 50, 48, 65, 52, 56, 46, 54, 49, 51, 47, 55, 55, 54, 42, 51, 56, 55, 51, 54, 51, 60, 62, 43, 55, 56, 61, 52, 69, 64, 46, 54, 47, 70]&lt;/p&gt;

&lt;p&gt;heights_and_ages = heights + ages &lt;br&gt;
heights_and_ages_arr = np.array(heights_and_ages)&lt;br&gt;
heights_and_ages_arr = heights_and_ages_arr.reshape((2,45))&lt;/p&gt;

&lt;p&gt;heights_and_ages_arr[0,:] = 180&lt;br&gt;
print(heights_and_ages_arr)&lt;/p&gt;

&lt;p&gt;We can also combine slicing to change any subset of the array. For example, to reassign 0 to the left upper corner:&lt;/p&gt;

&lt;p&gt;import numpy as np&lt;/p&gt;

&lt;p&gt;heights = [189, 170, 189, 163, 183, 171, 185, 168, 173, 183, 173, 173, 175, 178, 183, 193, 178, 173, 174, 183, 183, 180, 168, 180, 170, 178, 182, 180, 183, 178, 182, 188, 175, 179, 183, 193, 182, 183, 177, 185, 188, 188, 182, 185, 191]&lt;/p&gt;

&lt;p&gt;ages = [57, 61, 57, 57, 58, 57, 61, 54, 68, 51, 49, 64, 50, 48, 65, 52, 56, 46, 54, 49, 51, 47, 55, 55, 54, 42, 51, 56, 55, 51, 54, 51, 60, 62, 43, 55, 56, 61, 52, 69, 64, 46, 54, 47, 70]&lt;/p&gt;

&lt;p&gt;heights_and_ages = heights + ages&lt;br&gt;
heights_and_ages_arr = np.array(heights_and_ages)&lt;br&gt;
heights_and_ages_arr = heights_and_ages_arr.reshape((2,45))&lt;/p&gt;

&lt;p&gt;heights_and_ages_arr[:2, :2] = 0&lt;br&gt;
print(heights_and_ages_arr)&lt;/p&gt;

&lt;p&gt;NOTE:It is easy to update values in a subarray when you combine arrays with slicing. For more on basic slicing and advanced indexing in numpy check out this link.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    Assigning an Array to an Array
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;In addition, a 1darray or a 2darry can be assigned to a subset of another 2darray, as long as their shapes match. Recall the 2darray heights_and_ages_arr:&lt;/p&gt;

&lt;p&gt;import numpy as np&lt;/p&gt;

&lt;p&gt;heights = [189, 170, 189, 163, 183, 171, 185, 168, 173, 183, 173, 173, 175, 178, 183, 193, 178, 173, 174, 183, 183, 180, 168, 180, 170, 178, 182, 180, 183, 178, 182, 188, 175, 179, 183, 193, 182, 183, 177, 185, 188, 188, 182, 185, 191]&lt;/p&gt;

&lt;p&gt;ages = [57, 61, 57, 57, 58, 57, 61, 54, 68, 51, 49, 64, 50, 48, 65, 52, 56, 46, 54, 49, 51, 47, 55, 55, 54, 42, 51, 56, 55, 51, 54, 51, 60, 62, 43, 55, 56, 61, 52, 69, 64, 46, 54, 47, 70]&lt;/p&gt;

&lt;p&gt;heights_and_ages = heights + ages&lt;br&gt;
heights_and_ages_arr = np.array(heights_and_ages)&lt;br&gt;
heights_and_ages_arr = heights_and_ages_arr.reshape((2,45))&lt;br&gt;
print(heights_and_ages_arr)&lt;/p&gt;

&lt;p&gt;If we want to update both height and age of the first president with new data, we can supply the data in a list:&lt;/p&gt;

&lt;p&gt;import numpy as np&lt;/p&gt;

&lt;p&gt;heights = [189, 170, 189, 163, 183, 171, 185, 168, 173, 183, 173, 173, 175, 178, 183, 193, 178, 173, 174, 183, 183, 180, 168, 180, 170, 178, 182, 180, 183, 178, 182, 188, 175, 179, 183, 193, 182, 183, 177, 185, 188, 188, 182, 185, 191]&lt;/p&gt;

&lt;p&gt;ages = [57, 61, 57, 57, 58, 57, 61, 54, 68, 51, 49, 64, 50, 48, 65, 52, 56, 46, 54, 49, 51, 47, 55, 55, 54, 42, 51, 56, 55, 51, 54, 51, 60, 62, 43, 55, 56, 61, 52, 69, 64, 46, 54, 47, 70]&lt;/p&gt;

&lt;p&gt;heights_and_ages = heights + ages&lt;br&gt;
heights_and_ages_arr = np.array(heights_and_ages)&lt;br&gt;
heights_and_ages_arr = heights_and_ages_arr.reshape((2,45))&lt;/p&gt;

&lt;p&gt;heights_and_ages_arr[:, 0] = [190, 58]&lt;br&gt;
print(heights_and_ages_arr)&lt;/p&gt;

&lt;p&gt;We can also update data in a subarray with a numpy array as such:&lt;/p&gt;

&lt;p&gt;import numpy as np&lt;/p&gt;

&lt;p&gt;heights = [189, 170, 189, 163, 183, 171, 185, 168, 173, 183, 173, 173, 175, 178, 183, 193, 178, 173, 174, 183, 183, 180, 168, 180, 170, 178, 182, 180, 183, 178, 182, 188, 175, 179, 183, 193, 182, 183, 177, 185, 188, 188, 182, 185, 191]&lt;/p&gt;

&lt;p&gt;ages = [57, 61, 57, 57, 58, 57, 61, 54, 68, 51, 49, 64, 50, 48, 65, 52, 56, 46, 54, 49, 51, 47, 55, 55, 54, 42, 51, 56, 55, 51, 54, 51, 60, 62, 43, 55, 56, 61, 52, 69, 64, 46, 54, 47, 70]&lt;/p&gt;

&lt;p&gt;heights_and_ages = heights + ages&lt;br&gt;
heights_and_ages_arr = np.array(heights_and_ages)&lt;br&gt;
heights_and_ages_arr = heights_and_ages_arr.reshape((2,45))&lt;/p&gt;

&lt;p&gt;new_record = np.array([[180, 183, 190], [54, 50, 69]])&lt;br&gt;
heights_and_ages_arr[:, 42:] = new_record&lt;br&gt;
print(heights_and_ages_arr)&lt;/p&gt;

&lt;p&gt;Note the last three columns' values have changed.&lt;/p&gt;

&lt;p&gt;Updating a multidimensional array with a new record is straightforward in numpy as long as their shapes match.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;        Combining Two Arrays
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Oftentime we obtain data stored in different arrays and we need to combine them into one to keep it in one place. For example, instead of having the ages stored in a list, it could be stored in a 2darray:&lt;/p&gt;

&lt;p&gt;import numpy as np&lt;/p&gt;

&lt;p&gt;ages = [57, 61, 57, 57, 58, 57, 61, 54, 68, 51, 49, 64, 50, 48, 65, 52, 56, 46, 54, 49, 51, 47, 55, 55, 54, 42, 51, 56, 55, 51, 54, 51, 60, 62, 43, 55, 56, 61, 52, 69, 64, 46, 54, 47, 70]&lt;/p&gt;

&lt;p&gt;ages_arr = np.array(ages)&lt;/p&gt;

&lt;p&gt;print(ages_arr.shape)&lt;br&gt;
print(ages_arr[:3,])&lt;/p&gt;

&lt;p&gt;If we reshape the heights_arr to (45,1), the same as 'ages_arr', we can stack them horizontally (by column) to get a 2darray using 'hstack':&lt;/p&gt;

&lt;p&gt;import numpy as np&lt;/p&gt;

&lt;p&gt;heights = [189, 170, 189, 163, 183, 171, 185, 168, 173, 183, 173, 173, 175, 178, 183, 193, 178, 173, 174, 183, 183, 180, 168, 180, 170, 178, 182, 180, 183, 178, 182, 188, 175, 179, 183, 193, 182, 183, 177, 185, 188, 188, 182, 185, 191]&lt;br&gt;
ages = [57, 61, 57, 57, 58, 57, 61, 54, 68, 51, 49, 64, 50, 48, 65, 52, 56, 46, 54, 49, 51, 47, 55, 55, 54, 42, 51, 56, 55, 51, 54, 51, 60, 62, 43, 55, 56, 61, 52, 69, 64, 46, 54, 47, 70]&lt;/p&gt;

&lt;p&gt;heights_arr = np.array(heights)&lt;br&gt;
ages_arr = np.array(ages)&lt;/p&gt;

&lt;p&gt;heights_arr = heights_arr.reshape((45,1))&lt;br&gt;
ages_arr = ages_arr.reshape((45,1))&lt;/p&gt;

&lt;p&gt;height_age_arr = np.hstack((heights_arr, ages_arr))&lt;br&gt;
print(height_age_arr.shape)&lt;br&gt;
print(height_age_arr[:3,])&lt;/p&gt;

&lt;p&gt;Now height_age_arr has both heights and ages for the presidents, each column corresponds to the height and age of one president.&lt;/p&gt;

&lt;p&gt;Similarly, if we want to combine the arrays vertically (by row), we can use 'vstack'.&lt;/p&gt;

&lt;p&gt;import numpy as np&lt;/p&gt;

&lt;p&gt;heights = [189, 170, 189, 163, 183, 171, 185, 168, 173, 183, 173, 173, 175, 178, 183, 193, 178, 173, 174, 183, 183, 180, 168, 180, 170, 178, 182, 180, 183, 178, 182, 188, 175, 179, 183, 193, 182, 183, 177, 185, 188, 188, 182, 185, 191]&lt;br&gt;
ages = [57, 61, 57, 57, 58, 57, 61, 54, 68, 51, 49, 64, 50, 48, 65, 52, 56, 46, 54, 49, 51, 47, 55, 55, 54, 42, 51, 56, 55, 51, 54, 51, 60, 62, 43, 55, 56, 61, 52, 69, 64, 46, 54, 47, 70]&lt;/p&gt;

&lt;p&gt;heights_arr = np.array(heights)&lt;br&gt;
ages_arr = np.array(ages)&lt;/p&gt;

&lt;p&gt;heights_arr = heights_arr.reshape((1,45))&lt;br&gt;
ages_arr = ages_arr.reshape((1,45))&lt;/p&gt;

&lt;p&gt;height_age_arr = np.vstack((heights_arr, ages_arr))&lt;br&gt;
print(height_age_arr.shape)&lt;br&gt;
print(height_age_arr[:,:3])&lt;/p&gt;

&lt;p&gt;NOTE:To combine more than two arrays horizontally, simply add the additional arrays into the tuple.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                Concatenate
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;More generally, we can use the function numpy.concatenate. If we want to concatenate, link together, two arrays along rows, then pass 'axis = 1' to achieve the same result as using numpy.hstack; and pass 'axis = 0' if you want to combine arrays vertically.&lt;/p&gt;

&lt;p&gt;In the example from the previous part, we were using hstack to combine two arrays horizontally, instead:&lt;/p&gt;

&lt;p&gt;import numpy as np&lt;/p&gt;

&lt;p&gt;heights = [189, 170, 189, 163, 183, 171, 185, 168, 173, 183, 173, 173, 175, 178, 183, 193, 178, 173, 174, 183, 183, 180, 168, 180, 170, 178, 182, 180, 183, 178, 182, 188, 175, 179, 183, 193, 182, 183, 177, 185, 188, 188, 182, 185, 191]&lt;br&gt;
ages = [57, 61, 57, 57, 58, 57, 61, 54, 68, 51, 49, 64, 50, 48, 65, 52, 56, 46, 54, 49, 51, 47, 55, 55, 54, 42, 51, 56, 55, 51, 54, 51, 60, 62, 43, 55, 56, 61, 52, 69, 64, 46, 54, 47, 70]&lt;/p&gt;

&lt;p&gt;heights_arr = np.array(heights)&lt;br&gt;
ages_arr = np.array(ages)&lt;/p&gt;

&lt;p&gt;heights_arr = heights_arr.reshape((45,1))&lt;br&gt;
ages_arr = ages_arr.reshape((45,1))&lt;/p&gt;

&lt;h1&gt;
  
  
  height_age_arr = np.hstack((heights_arr, ages_arr))
&lt;/h1&gt;

&lt;p&gt;height_age_arr = np.concatenate((heights_arr, ages_arr), axis=1)&lt;/p&gt;

&lt;p&gt;print(height_age_arr.shape)&lt;br&gt;
print(height_age_arr[:3,:])&lt;/p&gt;

&lt;p&gt;Also you can get the same result as using vstack:&lt;/p&gt;

&lt;p&gt;import numpy as np&lt;/p&gt;

&lt;p&gt;heights = [189, 170, 189, 163, 183, 171, 185, 168, 173, 183, 173, 173, 175, 178, 183, 193, 178, 173, 174, 183, 183, 180, 168, 180, 170, 178, 182, 180, 183, 178, 182, 188, 175, 179, 183, 193, 182, 183, 177, 185, 188, 188, 182, 185, 191]&lt;br&gt;
ages = [57, 61, 57, 57, 58, 57, 61, 54, 68, 51, 49, 64, 50, 48, 65, 52, 56, 46, 54, 49, 51, 47, 55, 55, 54, 42, 51, 56, 55, 51, 54, 51, 60, 62, 43, 55, 56, 61, 52, 69, 64, 46, 54, 47, 70]&lt;/p&gt;

&lt;p&gt;heights_arr = np.array(heights)&lt;br&gt;
ages_arr = np.array(ages)&lt;/p&gt;

&lt;p&gt;heights_arr = heights_arr.reshape((1,45))&lt;br&gt;
ages_arr = ages_arr.reshape((1,45))&lt;/p&gt;

&lt;h1&gt;
  
  
  height_age_arr = np.vstack((heights_arr, ages_arr))
&lt;/h1&gt;

&lt;p&gt;height_age_arr = np.concatenate((heights_arr, ages_arr), axis=0)&lt;/p&gt;

&lt;p&gt;print(height_age_arr.shape)&lt;br&gt;
print(height_age_arr[:,:3])&lt;/p&gt;

&lt;p&gt;NOTE:You can use np.hstack to concatenate arrays ONLY if they have the same number of rows.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;         Numpy Array Method
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;In addition, there are several methods in numpy to perform more complex calculations on arrays. For example, the sum() method finds the sum of all the elements in an array:&lt;/p&gt;

&lt;p&gt;import numpy as np&lt;/p&gt;

&lt;p&gt;heights_arr = np.array([189, 170, 189, 163, 183, 171, 185, 168, 173, 183, 173, 173, 175, 178, 183, 193, 178, 173, 174, 183, 183, 180, 168, 180, 170, 178, 182, 180, 183, 178, 182, 188, 175, 179, 183, 193, 182, 183, 177, 185, 188, 188, 182, 185, 191])&lt;br&gt;
ages_arr = np.array([57, 61, 57, 57, 58, 57, 61, 54, 68, 51, 49, 64, 50, 48, 65, 52, 56, 46, 54, 49, 51, 47, 55, 55, 54, 42, 51, 56, 55, 51, 54, 51, 60, 62, 43, 55, 56, 61, 52, 69, 64, 46, 54, 47, 70]).reshape((-1,1))&lt;/p&gt;

&lt;p&gt;heights_arr = heights_arr.reshape((45,1))&lt;br&gt;
height_age_arr = np.hstack((heights_arr, ages_arr))&lt;/p&gt;

&lt;p&gt;print(height_age_arr.sum())&lt;/p&gt;

&lt;p&gt;The sum of all heights and ages is 10575. In order to sum all heights and sum all ages separately, we can specify axis=0 to calculate the sum across the rows, that is, it computes the sum for each column, or column sum. On the other hand, to obtain the row sums specify axis=1. In this example, we want to calculate the total sum of heights and ages, respectively:&lt;/p&gt;

&lt;p&gt;import numpy as np&lt;/p&gt;

&lt;p&gt;heights_arr = np.array([189, 170, 189, 163, 183, 171, 185, 168, 173, 183, 173, 173, 175, 178, 183, 193, 178, 173, 174, 183, 183, 180, 168, 180, 170, 178, 182, 180, 183, 178, 182, 188, 175, 179, 183, 193, 182, 183, 177, 185, 188, 188, 182, 185, 191])&lt;br&gt;
ages_arr = np.array([57, 61, 57, 57, 58, 57, 61, 54, 68, 51, 49, 64, 50, 48, 65, 52, 56, 46, 54, 49, 51, 47, 55, 55, 54, 42, 51, 56, 55, 51, 54, 51, 60, 62, 43, 55, 56, 61, 52, 69, 64, 46, 54, 47, 70]).reshape((-1,1))&lt;/p&gt;

&lt;p&gt;heights_arr = heights_arr.reshape((45,1))&lt;br&gt;
height_age_arr = np.hstack((heights_arr, ages_arr))&lt;/p&gt;

&lt;p&gt;print(height_age_arr.sum(axis=0))&lt;/p&gt;

&lt;p&gt;The output is the row sums: heights of all presidents (i.e., the first row) add up to 8100, and the sum of ages (i.e., the second row) is 2475.&lt;/p&gt;

&lt;p&gt;NOTE:Other operations, such as .min(), .max(), .mean(), work in a similar way to .sum().&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;                Comparisons
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;In practicing data science, we often encounter comparisons to identify rows that match certain values. We can use operations including "&amp;lt;", "&amp;gt;", "&amp;gt;=", "&amp;lt;=", and "==" to do so. For example, in the height_age_arr dataset, we might be interested in only those presidents who started their presidency younger than 55 years old.&lt;/p&gt;

&lt;p&gt;import numpy as np&lt;/p&gt;

&lt;p&gt;heights_arr = np.array([189, 170, 189, 163, 183, 171, 185, 168, 173, 183, 173, 173, 175, 178, 183, 193, 178, 173, 174, 183, 183, 180, 168, 180, 170, 178, 182, 180, 183, 178, 182, 188, 175, 179, 183, 193, 182, 183, 177, 185, 188, 188, 182, 185, 191])&lt;br&gt;
ages_arr = np.array([57, 61, 57, 57, 58, 57, 61, 54, 68, 51, 49, 64, 50, 48, 65, 52, 56, 46, 54, 49, 51, 47, 55, 55, 54, 42, 51, 56, 55, 51, 54, 51, 60, 62, 43, 55, 56, 61, 52, 69, 64, 46, 54, 47, 70]).reshape((-1,1))&lt;/p&gt;

&lt;p&gt;heights_arr = heights_arr.reshape((45,1))&lt;br&gt;
height_age_arr = np.hstack((heights_arr, ages_arr))&lt;/p&gt;

&lt;p&gt;print(height_age_arr[:, 1] &amp;lt; 55)&lt;/p&gt;

&lt;p&gt;The output is a 1darray with boolean values that indicates which presidents meet the criteria. If we are only interested in which presidents started their presidency at 51 years of age, we can use "==" instead.&lt;/p&gt;

&lt;p&gt;import numpy as np&lt;/p&gt;

&lt;p&gt;heights_arr = np.array([189, 170, 189, 163, 183, 171, 185, 168, 173, 183, 173, 173, 175, 178, 183, 193, 178, 173, 174, 183, 183, 180, 168, 180, 170, 178, 182, 180, 183, 178, 182, 188, 175, 179, 183, 193, 182, 183, 177, 185, 188, 188, 182, 185, 191])&lt;br&gt;
ages_arr = np.array([57, 61, 57, 57, 58, 57, 61, 54, 68, 51, 49, 64, 50, 48, 65, 52, 56, 46, 54, 49, 51, 47, 55, 55, 54, 42, 51, 56, 55, 51, 54, 51, 60, 62, 43, 55, 56, 61, 52, 69, 64, 46, 54, 47, 70]).reshape((-1,1))&lt;/p&gt;

&lt;p&gt;heights_arr = heights_arr.reshape((45,1))&lt;br&gt;
height_age_arr = np.hstack((heights_arr, ages_arr))&lt;/p&gt;

&lt;p&gt;print(height_age_arr[:, 1] == 51)&lt;/p&gt;

&lt;p&gt;NOTE:To find out how many rows satisfy the condition, use .sum() on the resultant 1d boolean array, e.g., (height_age_arr[:, 1] == 51).sum(), to see that there were exactly five presidents who started the presidency at age 51. True is treated as 1 and False as 0 in the sum.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;          Mask &amp;amp; Subsetting
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Now that rows matching certain criteria can be identified, a subset of the data can be found. For example, instead of the entire dataset, we want only tall presidents, that is, those presidents whose height is greater than or equal to 182 cm. We first create a mask, 1darray with boolean values:&lt;/p&gt;

&lt;p&gt;import numpy as np&lt;/p&gt;

&lt;p&gt;heights_arr = np.array([189, 170, 189, 163, 183, 171, 185, 168, 173, 183, 173, 173, 175, 178, 183, 193, 178, 173, 174, 183, 183, 180, 168, 180, 170, 178, 182, 180, 183, 178, 182, 188, 175, 179, 183, 193, 182, 183, 177, 185, 188, 188, 182, 185, 191])&lt;br&gt;
ages_arr = np.array([57, 61, 57, 57, 58, 57, 61, 54, 68, 51, 49, 64, 50, 48, 65, 52, 56, 46, 54, 49, 51, 47, 55, 55, 54, 42, 51, 56, 55, 51, 54, 51, 60, 62, 43, 55, 56, 61, 52, 69, 64, 46, 54, 47, 70]).reshape((-1,1))&lt;/p&gt;

&lt;p&gt;heights_arr = heights_arr.reshape((45,1))&lt;br&gt;
height_age_arr = np.hstack((heights_arr, ages_arr))&lt;/p&gt;

&lt;p&gt;mask = height_age_arr[:, 0] &amp;gt;= 182&lt;br&gt;
print(mask.sum())&lt;/p&gt;

&lt;p&gt;Then pass it to the first axis of &lt;code&gt;height_age_arr&lt;/code&gt; to filter presidents who don’t meet the criteria:&lt;/p&gt;

&lt;p&gt;numpy as np&lt;/p&gt;

&lt;p&gt;heights_arr = np.array([189, 170, 189, 163, 183, 171, 185, 168, 173, 183, 173, 173, 175, 178, 183, 193, 178, 173, 174, 183, 183, 180, 168, 180, 170, 178, 182, 180, 183, 178, 182, 188, 175, 179, 183, 193, 182, 183, 177, 185, 188, 188, 182, 185, 191])&lt;br&gt;
ages_arr = np.array([57, 61, 57, 57, 58, 57, 61, 54, 68, 51, 49, 64, 50, 48, 65, 52, 56, 46, 54, 49, 51, 47, 55, 55, 54, 42, 51, 56, 55, 51, 54, 51, 60, 62, 43, 55, 56, 61, 52, 69, 64, 46, 54, 47, 70]).reshape((-1,1))&lt;/p&gt;

&lt;p&gt;heights_arr = heights_arr.reshape((45,1))&lt;br&gt;
height_age_arr = np.hstack((heights_arr, ages_arr))&lt;/p&gt;

&lt;p&gt;mask = height_age_arr[:, 0] &amp;gt;= 182&lt;br&gt;
tall_presidents = height_age_arr[mask, ]&lt;br&gt;
tall_presidents.shape&lt;/p&gt;

&lt;p&gt;print(tall_presidents.shape)&lt;/p&gt;

&lt;p&gt;This is a subarray of height_age_arr, and all presidents in tall_presidents were at least 182cm tall.&lt;/p&gt;

&lt;p&gt;NOTE:Masking is used to extract, modify, count, or otherwise manipulate values in an array based on some criterion. In our example, the criteria was height of 182cm or taller.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;             Multiple Criteria
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;We can create a mask satisfying more than one criteria. For example, in addition to height, we want to find those presidents that were 50 years old or younger at the start of their presidency. To achieve this, we use &amp;amp; to separate the conditions and each condition is encapsulated with parentheses "()" as shown below:&lt;/p&gt;

&lt;p&gt;import numpy as np&lt;/p&gt;

&lt;p&gt;heights_arr = np.array([189, 170, 189, 163, 183, 171, 185, 168, 173, 183, 173, 173, 175, 178, 183, 193, 178, 173, 174, 183, 183, 180, 168, 180, 170, 178, 182, 180, 183, 178, 182, 188, 175, 179, 183, 193, 182, 183, 177, 185, 188, 188, 182, 185, 191])&lt;br&gt;
ages_arr = np.array([57, 61, 57, 57, 58, 57, 61, 54, 68, 51, 49, 64, 50, 48, 65, 52, 56, 46, 54, 49, 51, 47, 55, 55, 54, 42, 51, 56, 55, 51, 54, 51, 60, 62, 43, 55, 56, 61, 52, 69, 64, 46, 54, 47, 70]).reshape((-1,1))&lt;/p&gt;

&lt;p&gt;heights_arr = heights_arr.reshape((45,1))&lt;br&gt;
height_age_arr = np.hstack((heights_arr, ages_arr))&lt;/p&gt;

&lt;p&gt;mask = (height_age_arr[:, 0]&amp;gt;=182) &amp;amp; (height_age_arr[:,1]&amp;lt;=50)&lt;/p&gt;

&lt;p&gt;print(height_age_arr[mask,])&lt;/p&gt;

&lt;p&gt;The results show us that there are four presidents who satisfy both conditions.&lt;/p&gt;

&lt;p&gt;NOTE:Data manipulation in Python is nearly synonymous with Numpy array manipulation. Operations shown here are the building blocks of many other examples used throughout this course. It is important to master them!&lt;/p&gt;

&lt;p&gt;Thank you for reading, &lt;br&gt;
you can contact us for more at &lt;a href="mailto:cromajet1@gmail.com"&gt;cromajet1@gmail.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The next book will follow as Data Analysis.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--65gid82D--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j22qckxlx3zdqynrc4gz.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--65gid82D--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j22qckxlx3zdqynrc4gz.jpeg" alt="Image description" width="781" height="393"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Version Control of git/github</title>
      <dc:creator>Kebee crc</dc:creator>
      <pubDate>Sun, 12 Feb 2023 22:33:17 +0000</pubDate>
      <link>https://dev.to/cromajetex/version-control-of-gitgithub-15e7</link>
      <guid>https://dev.to/cromajetex/version-control-of-gitgithub-15e7</guid>
      <description>&lt;p&gt;Git/Github&lt;br&gt;
(1)What is Version Control?&lt;br&gt;
When you are working on a simple project, such as a single page html, it is fairly easy to remember the last thing you changed and where the development is headed. But tracking revisions over time, also referred to as version control, quickly becomes more complex when you are working on a large project with multiple files and multiple developers.&lt;/p&gt;

&lt;p&gt;You not only want to record changes, but also who made the changes, and when. Managing revisions at this level requires a version control system.&lt;/p&gt;

&lt;p&gt;Version Control Systems (VCS) help a software team manage changes to source code over time. &lt;br&gt;
VCS software includes tools for saving the state of a project, viewing the history of changes, and reverting changes. &lt;br&gt;
Developing software without using version control is risky, similar to not having backups.&lt;/p&gt;

&lt;p&gt;VCS can also enhance and speed up development. Depending on the version control software used, many developers can work on the same code at the same time.&lt;br&gt;
For example, one developer on the team may be working on a new feature while another developer fixes an unrelated bug, each developer making their changes in several parts of the code base. &lt;/p&gt;

&lt;p&gt;VCS even have tools to prevent conflicts when one developer's changes are incompatible with changes made at the same time by another developer.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  (2)The Git Version Control System
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;One of the most popular version control systems is Git, a distributed VCS. &lt;br&gt;
Git is a mature, actively maintained, open source project compatible with many operating systems and IDEs. &lt;br&gt;
Git is different from other version control systems by its way of recording changes. Other systems add changes to a database, where Git records changes as a stream of snapshots.&lt;/p&gt;

&lt;p&gt;Git has another advantage - it is distributed. &lt;br&gt;
Rather than having only one single place for the full version history of a project, every developer's working copy of the code is also a repository that can contain the full history of all changes.&lt;/p&gt;

&lt;p&gt;Git was created by Linus Torvalds in 2005 for development of the Linux kernel, with other kernel developers contributing to its initial development.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;      (3)Initializing a Git Repository
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The most effective way to run Git is through a command line prompt. That means you'll be using Terminal in Mac/Linux or Command Prompt or PowerShell in Windows.&lt;/p&gt;

&lt;p&gt;The first step to start using Git is to initialize a repository, a location for files and their revision history. Of course, this step can only be taken if you've already installed Git on your computer. There are numerous versions and ways to install Git. Which one you use will depend on your environment. Download the version that suits you from the official website.&lt;/p&gt;

&lt;p&gt;If you want a repository in a new folder, then you will need to create a new directory (folder) and then switch to that directory. This is done at the command prompt (often indicated with $ or C:&amp;gt;) with the mkdir command for creating a directory and cd for navigating to a directory.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;     $ mkdir my_git_project
     $ cd my_git_project
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;With the commands above, a directory named my_git_project is created in the current folder and then the active directory is changed to my_git_project.&lt;/p&gt;

&lt;p&gt;If you want to create the repository in an already existing folder, just navigate to that directory by typing cd directory_name at the command line prompt.&lt;/p&gt;

&lt;p&gt;Once inside the appropriate folder, use the git init command to turn the directory into an empty Git repository:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; $ git init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
    </item>
    <item>
      <title>HTML tags</title>
      <dc:creator>Kebee crc</dc:creator>
      <pubDate>Fri, 20 Jan 2023 08:11:10 +0000</pubDate>
      <link>https://dev.to/cromajetex/html-tags-33bj</link>
      <guid>https://dev.to/cromajetex/html-tags-33bj</guid>
      <description>&lt;blockquote&gt;     &lt;br&gt;        &lt;center&gt;    &lt;code&gt;  &lt;col&gt;  &lt;colgroup&gt;        &lt;dd&gt;  &lt;del&gt;          &lt;dl&gt;  &lt;dt&gt;  &lt;em&gt;        fiqure&amp;gt;            &lt;h1&gt;                &lt;img&gt;        
&lt;/h1&gt;&lt;/em&gt;
&lt;/dt&gt;
&lt;/dl&gt;&lt;/del&gt;
&lt;/dd&gt;
&lt;/colgroup&gt;&lt;/code&gt;
&lt;/center&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.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%2F5gt8ebs3uukehdgx0cbt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2F5gt8ebs3uukehdgx0cbt.png" alt="Image description" width="800" height="1035"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>discuss</category>
    </item>
  </channel>
</rss>
