<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Nazlı Şener on Medium]]></title>
        <description><![CDATA[Stories by Nazlı Şener on Medium]]></description>
        <link>https://medium.com/@nazlsener?source=rss-cd1336e245fd------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*MM9gpYRmVuSYHt3WV49lkg.jpeg</url>
            <title>Stories by Nazlı Şener on Medium</title>
            <link>https://medium.com/@nazlsener?source=rss-cd1336e245fd------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 00:06:17 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nazlsener/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Pyhton Libraries – NumPy & Pandas]]></title>
            <link>https://medium.com/@nazlsener/pyhton-libraries-numpy-pandas-79606279eac6?source=rss-cd1336e245fd------2</link>
            <guid isPermaLink="false">https://medium.com/p/79606279eac6</guid>
            <category><![CDATA[pandas]]></category>
            <category><![CDATA[numpy]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Nazlı Şener]]></dc:creator>
            <pubDate>Wed, 15 Dec 2021 20:46:27 GMT</pubDate>
            <atom:updated>2021-12-15T20:46:27.724Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*hqBaDqLIHX6jkLc6lhNXYA.jpeg" /></figure><p><strong>NumPy</strong> is one of the most popular libraries that is used for scientific calculating in Python. NumPy library is usually used in scientific calculations and also is used to perform operations that are more difficult to perform mathematically.</p><p><strong>Setup</strong></p><p>NumPy library must be imported before you proceed. Typing <strong>“import numpy as np”</strong> is a universal way to import it. Now, let’s see what you can do with NumPy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*XEg9IP6A7A_D7gbfflhLCw.png" /></figure><p><strong>NumPy Array</strong></p><p>There are many things that can be done with NumPy but mainly you use it to create arrays. There are several ways as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*yUaPOWsFbqbXFchR-hjNlw.png" /></figure><p>Pyhton lists named a and c have been created. To convert a list to a numpy array, you need to use np.the sequence in the application.<br>This is what we did in the first and third lines of the code.</p><p><strong>Note: </strong>You<strong> </strong>can use the <strong>type</strong> function to check the data type of both list a and list c.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/1*bOIStKQFS5mwiZmoX1NU1A.png" /></figure><p><strong>Functions for Creating NumPy Array</strong></p><p>There are different methods to create numpy arrays. Let’s see at several methods.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OCPofV0t8xYrXsBA_qa8gg.png" /></figure><p>All you need to do to create a simple array is forward a list to it. If you choose to, you can also specify the type of data in your list. You can find more information about data types <a href="https://numpy.org/devdocs/user/quickstart.html#arrays-dtypes">here.</a></p><p><strong>Input</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/924/1*5nsGz1F6866To-vyGSCl3A.png" /></figure><p><strong>Output:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/1*Zkfe3QZEJ5ff0pM-UsBGAA.png" /></figure><p><strong>Input:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/1*Qfh5jPDVShKXIxZc4HERQg.png" /></figure><p><strong>Output:</strong></p><figure><img alt="When a single number is pass to the zeros method and an argument, it returns a one-dimensional array of the number." src="https://cdn-images-1.medium.com/max/828/1*qnlkehSgOcdyb_pZXhLb7Q.png" /><figcaption>When a single number is pass to the zeros method and an argument, it returns a one-dimensional array of the number.</figcaption></figure><p><strong>Input:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/854/1*EoLQJGNiTd3PhEy2sugEnA.png" /></figure><p><strong>Output:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/1*0duRuPk791m1sS0MCFoIng.png" /><figcaption>Here passing only two numerical values. This will generate numbers decimated between 1 and 10.</figcaption></figure><p><strong>Input:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/856/1*akjTQASRcsqQixE7JTP4JA.png" /></figure><p><strong>Output:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/788/1*0BFxLH2IcjS0KFbPAcPz5Q.png" /><figcaption>This will generate numbers as random integer values between 0 and 10.</figcaption></figure><p><strong>Input:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jR1zNduCiVqTOo4wv_039g.png" /></figure><p><strong>Output:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qSnzFREpRwrxbE1-e_4Bfg.png" /><figcaption>This will generate 3x4 matrix with an as average 10 and standard deviation 4.</figcaption></figure><p><strong>Input:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/806/1*BDiDYLVJp0CP42y1VlpQsw.png" /></figure><p><strong>Output:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/436/1*7N3U9Lp5WLIf9Zn0PF0uEw.png" /><figcaption>This will generate 3x3 matrix with integer values.</figcaption></figure><p><strong>NumPy Array Features</strong></p><p><strong>n.dim - </strong>number of dimensions</p><p><strong>shape - </strong>size of array</p><p><strong>size -</strong>number of elements</p><p><strong>dtype- </strong>array data type</p><p>The numPy arrays provide the ability to reshape the array using the<strong> reshape()</strong> method which is used to change the size of an array, it can be used to convert a one-dimensional array to a two-dimensional array.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/704/1*i6FaP7w9rtWJLJhZ8XMlpQ.png" /></figure><p><strong>Fancy Indexing</strong></p><p>Indexing allows us to select entire rows or columns out of order.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/922/1*0K4lGTP7LE2CY7J9aVIVPQ.png" /><figcaption>Fancy indexing enable us to catch row 1,2 and 3.</figcaption></figure><p><strong>Universal Functions (ufunc)</strong></p><p>NumPy has a number of built-in mathematical operations. You can use them to perform a specific task throughout the NumPy array, associate it with the function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/858/1*gEQwuD9CGi2I86oT56GRCQ.png" /></figure><p>You can find more information about universal functions from <a href="https://numpy.org/doc/stable/reference/ufuncs.html">here.</a></p><p><strong>Pandas</strong> is an open-source library built on NumPy. It allows data analysis, data cleaning and preparation. It compared to the NumPy library, it can work with different data types.</p><p><strong>Setup</strong></p><p>Pandas just like NumPy library, first have to import it before you get access to its methods. You can decide to give it any other name instead of pd but pd is the accepted and general way.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/606/1*okSskRibyCDwaXaVk0Tz1Q.png" /></figure><p><strong>Pandas Series</strong></p><p>Pandas series are very similar to the numpy array object. The obvious difference between numpy series and pandas series, pandas series can also take various data. Now, let’s look at create an series.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/444/1*fDL5qfJVxtguttk5Gn6aow.png" /></figure><p><strong>Quick Check Data Sets with Pandas</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/872/1*AY-w78ElQ4atS78hsuvn5Q.png" /></figure><p>Let’s take a look at the main actions that you will do to familiarize ourselves with the data</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1J4Ui48LAGXGQScuh1o9qg.png" /></figure><p><strong>Actions on the Index (Accessing Data)</strong></p><p>You can access the data in the Data by using operations that will be applied to rows and column.</p><p>To access a column in the data, the column name is passed in square brackets. If you want to access more than one column, it will be enough to use two square brackets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/440/1*ZkjN5yLTRvA4p-hD4lLjLQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/398/1*GHrRUZh_duwwUh033H48Mw.png" /></figure><p>Accessing data in a rows can be had with the <strong>loc</strong> or <strong>iloc</strong> method. Now, let’s look how they work.</p><p><strong>loc</strong></p><p>With the loc method you pass in the name of the row. You can see that code access all the values in the 3. row in the below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/810/1*ZCtXR6CRibOaF6JdoODTAQ.png" /></figure><p><strong>iloc</strong></p><p>With the iloc method you pass the range of index. You can see that the code access the values from 0 to 3.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NmGjXqwhpobU7KNJUDHnFA.png" /></figure><p><strong>Removing Columns</strong></p><p>The <strong>drop</strong> method can be used to remove both a rows and columns.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R0HK6hjDAX-cUhW6ejdE8A.png" /><figcaption>Removing a column</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*977gEgDEMPnvO1BkyqhY7Q.png" /><figcaption>Removing a row</figcaption></figure><p><strong>Note: </strong>If you want the removing process to be permanent, you can use the i<strong>nplace=true</strong> argument.Inplace, if it’s set to true, the DataFrame will be updated in place, instead of a copy being returned.</p><p><strong>Grouping &amp; Aggregation</strong></p><p>Grouping is an essential part of data analyzing in Pandas. You can group similar types of data and apply various functions on them. For this operation you will use the <strong>groupby()</strong> function. Also, Pandas provide us with a variety of aggregate functions. These functions help to perform various activities on the datasets.The functions are: count, first, last, mean, median, min, max, std, var, sum.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EsRrFN5R8SXMgffevdJLhg.png" /></figure><p><strong>Great Many Functions Used in Pandas</strong></p><p><strong>apply()</strong>- It is used to call user-defined functions on a DataFrame.</p><p><strong>dropna()</strong>- is used to drop columns having null values/missing values.</p><p><strong>sort_values()-</strong> it gets the column name as the parameter and sorts in ascending order by default. Example: df.sort_values(“Age”,ascending=True)</p><p><strong>concat()</strong>- is used to add data on a by row basis.</p><p><strong>merge()</strong>-is used to perform joins on a by column basis.</p><p><strong>qcut()-</strong> allows the function to split the data.</p><p>Reference: <a href="https://www.veribilimiokulu.com/">https://www.veribilimiokulu.com</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=79606279eac6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>