<?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 Shabnam Hamidi Moghaddam on Medium]]></title>
        <description><![CDATA[Stories by Shabnam Hamidi Moghaddam on Medium]]></description>
        <link>https://medium.com/@shabnamhamidi1993?source=rss-49976dd129fd------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*-k0PZ6ZvicfwHdoxovkNzA.jpeg</url>
            <title>Stories by Shabnam Hamidi Moghaddam on Medium</title>
            <link>https://medium.com/@shabnamhamidi1993?source=rss-49976dd129fd------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 00:44:14 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shabnamhamidi1993/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[Unlocking the Secrets of FIFA21: A Journey Through Messy Data]]></title>
            <link>https://medium.com/@shabnamhamidi1993/unlocking-the-secrets-of-fifa21-a-journey-through-messy-data-ca7e6b40cf06?source=rss-49976dd129fd------2</link>
            <guid isPermaLink="false">https://medium.com/p/ca7e6b40cf06</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[fifa-21]]></category>
            <category><![CDATA[eda]]></category>
            <category><![CDATA[messy-data]]></category>
            <category><![CDATA[visualization]]></category>
            <dc:creator><![CDATA[Shabnam Hamidi Moghaddam]]></dc:creator>
            <pubDate>Wed, 02 Aug 2023 11:18:15 GMT</pubDate>
            <atom:updated>2023-08-02T11:18:15.041Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Unlocking the Secrets of FIFA21" src="https://cdn-images-1.medium.com/max/1024/1*xAvwOy94Xs3hWMQAv2IyCA.jpeg" /><figcaption>Unlocking the Secrets of FIFA21</figcaption></figure><p>Welcome to the world of FIFA! As a data enthusiast, I embarked on a thrilling journey to analyze EA Sports of the FIFA series, FIFA21. Thanks to the incredible work of a fellow data enthusiast who scraped and made the dataset available on <a href="https://www.kaggle.com/datasets/yagunnersya/fifa-21-messy-raw-dataset-for-cleaning-exploring?select=fifa21_raw_data.csv%E2%80%8B">Kaggle</a>, we have the opportunity to dive deep into this treasure trove of football data.</p><p>In this article, we’ll embark on an exciting adventure of cleaning and exploring the data. Just like football can be unpredictable, web scraping brings in messy data. But fear not! We’ll navigate through the chaos and turn it into valuable insights.</p><h3>Step 1: Reading the Data</h3><p>To begin our data exploration, we use Python’s powerful pandas library to read the dataset into a DataFrame. This allows us to easily manipulate and analyze the data.</p><pre>import pandas as pd<br><br>df = pd.read_csv(&#39;C:/Users/Shabnam/Project1/fifa21_raw_data.csv&#39;)<br>df.head()</pre><h3>Step 2: Handling Missing Values</h3><p>Before we dive into the analysis, let’s check for missing values in our dataset. Missing values can affect our insights, and addressing them is crucial for accurate analysis.</p><pre>df.isnull().sum()</pre><h3>Step 3: Understanding the Data</h3><p>To get a better understanding of our dataset, we’ll explore its structure and information. This includes the number of entries, data types, and non-null counts for each column.</p><pre>df.info()</pre><pre>&lt;class &#39;pandas.core.frame.DataFrame&#39;&gt;<br>RangeIndex: 18979 entries, 0 to 18978<br>Data columns (total 77 columns):<br> #   Column            Non-Null Count  Dtype <br>---  ------            --------------  ----- <br> 0   photoUrl          18979 non-null  object<br> 1   LongName          18979 non-null  object<br> 2   playerUrl         18979 non-null  object<br> 3   Nationality       18979 non-null  object<br> 4   Positions         18979 non-null  object<br> 5   Name              18979 non-null  object<br> 6   Age               18979 non-null  int64 <br> 7   ↓OVA              18979 non-null  int64 <br> 8   POT               18979 non-null  int64 <br> 9   Team &amp; Contract   18979 non-null  object<br> 10  ID                18979 non-null  int64 <br> 11  Height            18979 non-null  object<br> 12  Weight            18979 non-null  object<br> 13  foot              18979 non-null  object<br> 14  BOV               18979 non-null  int64 <br> 15  BP                18979 non-null  object<br> 16  Growth            18979 non-null  int64 <br> 17  Joined            18979 non-null  object<br> 18  Loan Date End     1013 non-null   object<br> 19  Value             18979 non-null  object<br> 20  Wage              18979 non-null  object<br> 21  Release Clause    18979 non-null  object<br> 22  Attacking         18979 non-null  int64 <br> 23  Crossing          18979 non-null  int64 <br> 24  Finishing         18979 non-null  int64 <br> 25  Heading Accuracy  18979 non-null  int64 <br> 26  Short Passing     18979 non-null  int64 <br> 27  Volleys           18979 non-null  int64 <br> 28  Skill             18979 non-null  int64 <br> 29  Dribbling         18979 non-null  int64 <br> 30  Curve             18979 non-null  int64 <br> 31  FK Accuracy       18979 non-null  int64 <br> 32  Long Passing      18979 non-null  int64 <br> 33  Ball Control      18979 non-null  int64 <br> 34  Movement          18979 non-null  int64 <br> 35  Acceleration      18979 non-null  int64 <br> 36  Sprint Speed      18979 non-null  int64 <br> 37  Agility           18979 non-null  int64 <br> 38  Reactions         18979 non-null  int64 <br> 39  Balance           18979 non-null  int64 <br> 40  Power             18979 non-null  int64 <br> 41  Shot Power        18979 non-null  int64 <br> 42  Jumping           18979 non-null  int64 <br> 43  Stamina           18979 non-null  int64 <br> 44  Strength          18979 non-null  int64 <br> 45  Long Shots        18979 non-null  int64 <br> 46  Mentality         18979 non-null  int64 <br> 47  Aggression        18979 non-null  int64 <br> 48  Interceptions     18979 non-null  int64 <br> 49  Positioning       18979 non-null  int64 <br> 50  Vision            18979 non-null  int64 <br> 51  Penalties         18979 non-null  int64 <br> 52  Composure         18979 non-null  int64 <br> 53  Defending         18979 non-null  int64 <br> 54  Marking           18979 non-null  int64 <br> 55  Standing Tackle   18979 non-null  int64 <br> 56  Sliding Tackle    18979 non-null  int64 <br> 57  Goalkeeping       18979 non-null  int64 <br> 58  GK Diving         18979 non-null  int64 <br> 59  GK Handling       18979 non-null  int64 <br> 60  GK Kicking        18979 non-null  int64 <br> 61  GK Positioning    18979 non-null  int64 <br> 62  GK Reflexes       18979 non-null  int64 <br> 63  Total Stats       18979 non-null  int64 <br> 64  Base Stats        18979 non-null  int64 <br> 65  W/F               18979 non-null  object<br> 66  SM                18979 non-null  object<br> 67  A/W               18979 non-null  object<br> 68  D/W               18979 non-null  object<br> 69  IR                18979 non-null  object<br> 70  PAC               18979 non-null  int64 <br> 71  SHO               18979 non-null  int64 <br> 72  PAS               18979 non-null  int64 <br> 73  DRI               18979 non-null  int64 <br> 74  DEF               18979 non-null  int64 <br> 75  PHY               18979 non-null  int64 <br> 76  Hits              18979 non-null  object<br>dtypes: int64(55), object(22)<br>memory usage: 11.1+ MB</pre><h3>Step 4: Converting Columns to Numeric</h3><p>We notice that some columns, such as ‘Height,’ ‘Weight,’ ‘Value,’ ‘Wage,’ and ‘Release Clause,’ are currently stored as objects (strings). To perform numerical calculations on these columns, we need to convert them to numeric data types.</p><pre>height_data = df[&#39;Height&#39;]<br>weight_data = df[&#39;Weight&#39;]<br><br>print(height_data)</pre><pre>0         5&#39;7&quot;<br>1         6&#39;2&quot;<br>2         6&#39;2&quot;<br>3        5&#39;11&quot;<br>4         5&#39;9&quot;<br>         ...  <br>18974    5&#39;10&quot;<br>18975     5&#39;7&quot;<br>18976    5&#39;10&quot;<br>18977     5&#39;9&quot;<br>18978     5&#39;9&quot;<br>Name: Height, Length: 18979, dtype: object</pre><p>The format of the “Height” column is feet and inches (e.g., 5 feet 7 inches), so we’ll need to convert this to centimeters (1 foot = 30.48 cm, 1 inch = 2.54 cm).</p><pre>def convert_to_cm(height):<br>    try:<br>        feet, inches = height.split(&quot;&#39;&quot;)<br>        return int(feet) * 30.48 + int(inches[:-1]) * 2.54<br>    except:<br>        return None  # Return None for any error or unexpected format<br><br>df[&#39;Height&#39;] = df[&#39;Height&#39;].apply(convert_to_cm)<br>print(df[&#39;Height&#39;])</pre><p>and so on for weight data:</p><pre>def convert_to_kg(weight):<br>    try:<br>        return int(weight.replace(&#39;lbs&#39;, &#39;&#39;))<br>    except:<br>        return None  # Return None for any error<br><br>df[&#39;Weight&#39;] = df[&#39;Weight&#39;].apply(convert_to_kg)<br>print(df[&#39;Weight&#39;])</pre><h3>Step 5: Removing Newline Characters</h3><p>In the ‘Hits’ column, we have unnecessary newline characters that can disrupt our analysis. We’ll remove them to ensure clean and consistent data.</p><pre>df[&#39;Hits&#39;] = df[&#39;Hits&#39;].str.replace(&#39;\n&#39;, &#39;&#39;)</pre><h3>Step 6: Splitting ‘Team &amp; Contract’ Column</h3><pre>#splitting team and contract into 2 seperate columns <br>df[&#39;Team &amp; Contract&#39;] = df[&#39;Team &amp; Contract&#39;].astype(&#39;str&#39;) <br>df[&#39;Team &amp; Contract&#39;].replace(&#39;\n&#39;, &#39;&#39;, regex=True, inplace=True)<br>test = df[&#39;Team &amp; Contract&#39;][0]<br>Team = []<br>Contract_Duration = []<br>for x in range(len(df[&#39;Team &amp; Contract&#39;])):<br>    Team.append(str(df[&#39;Team &amp; Contract&#39;][x][:-11]))<br>    c = str(df[&#39;Team &amp; Contract&#39;][x][-11:])<br>    if c.startswith(&quot;2&quot;) == True: <br>        Contract_Duration.append(c)<br>    else:<br>        Contract_Duration.append(&quot;0&quot;)<br>df = df.drop(columns = [&#39;Team &amp; Contract&#39;])   <br>df[&#39;Team&#39;] = Team<br>df[&#39;Contract Duration&#39;] = Contract_Duration</pre><p>Now let’s do some visualizations to understand the dataset more and more.</p><h3>Player Rating Distribution:</h3><p>Visualize the distribution of player ratings (OVA) using a histogram or a density plot to see how the ratings are distributed across the players in the game. The histogram displays the count of players within each rating range.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/704/1*O8Cmg7J5nTY0d3BLKlQeFg.png" /></figure><h3>Top Nationalities:</h3><p>Create bar charts to display the top nationalities with the highest number of players in the dataset, providing a glimpse into the dominant teams and countries.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/989/1*LMHuscRX7ln1xNRbqJd0yw.png" /></figure><h3>Age Distribution of Players:</h3><p>Plot the age distribution of players using a histogram to understand the age demographics of football stars.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/989/1*iknUce5IwWuQgCkWHJP_MQ.png" /></figure><h3>National Team Ratings:</h3><p>Create a bar chart to compare the average ratings of players in different national teams, showcasing the strongest footballing nations in FIFA21.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bq8IeBVUIkrwO2rGDBZH6A.png" /></figure><h3>Top Goal Scorers:</h3><p>Display a bar chart of the top goal-scorers based on their finishing attribute, highlighting the most lethal goal-scorers in the game.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/989/1*oRESoddqAdmCZEPT8YrkDw.png" /></figure><p>check out my <a href="https://github.com/shbnm93/Portfolio/tree/main/Project1">GitHub </a>for more info.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ca7e6b40cf06" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Analyze the Popularity of Different Programming Languages over Time]]></title>
            <link>https://medium.com/@shabnamhamidi1993/analyze-the-popularity-of-different-programming-languages-over-time-9e19e5c006b?source=rss-49976dd129fd------2</link>
            <guid isPermaLink="false">https://medium.com/p/9e19e5c006b</guid>
            <category><![CDATA[programming-languages]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[stackoverflow]]></category>
            <category><![CDATA[pandas]]></category>
            <category><![CDATA[matplotlib]]></category>
            <dc:creator><![CDATA[Shabnam Hamidi Moghaddam]]></dc:creator>
            <pubDate>Mon, 17 Oct 2022 13:13:54 GMT</pubDate>
            <atom:updated>2022-10-17T13:13:54.871Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mui_vPqdgWMuDVjS5g3C8g.jpeg" /></figure><p>The oldest programming language still in use today is <a href="https://en.wikipedia.org/wiki/Fortran">FORTRAN</a>, which was developed in 1957. Since then many other programming languages have been developed.</p><p><strong>But which programming language is the most popular?</strong></p><p><a href="https://stackoverflow.com/questions">Stack Overflow</a> will help us answer this burning question. Each post on Stack Overflow comes with a <strong>Tag</strong>.</p><p>And this Tag can be the name of a programming language.</p><p>To figure out which language is the most popular, all we need to do is count the number of posts on Stack Overflow that are tagged with each language. The language with the most posts wins!</p><p>I will do this project on <a href="https://colab.research.google.com/"><strong>Colab Notebook</strong></a>. You can access the file from my <a href="https://github.com/shbnm93/QueryResults"><strong>Github</strong></a><strong>.</strong></p><p>We will start with data exploration and read the .csv file and store it in a Pandas DataFrame called df. Have a look at the <a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.html">read_csv() documentation</a> and try to provide these column names: [&#39;DATE&#39;, &#39;TAG&#39;, &#39;POSTS&#39;]</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/44d7e7d29da6a60744de88c81a54d5d3/href">https://medium.com/media/44d7e7d29da6a60744de88c81a54d5d3/href</a></iframe><p>Look at the first and last 5 rows of the DataFrame. This allows us to verify that our column naming worked as intended.</p><pre>df<strong>.</strong>head()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*FH_jfAxg9NtKWK_W28W99A.png" /><figcaption>The TAG is the name of the programming language. So for example in July 2008, there were 3 posts tagged with the language C#.</figcaption></figure><pre>df<strong>.</strong>tail()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/381/1*ecbn5YroO2HzDgM7bRmHiA.png" /><figcaption>Some languages are older like C and other languages are newer (like Swift).</figcaption></figure><p>How many rows and how many columns does it have?</p><pre>df<strong>.</strong>shape</pre><pre>(1991, 3)</pre><p>To count the number of entries in each column: we can use .count().</p><p>Note that .count() will actually tell us the number of non-NaN values in each column.</p><pre>df<strong>.</strong>count()</pre><pre>DATE     1991<br>TAG      1991<br>POSTS    1991<br>dtype: int64</pre><p>The dataset starts in July 2008, so some languages will not have any posts for every month.</p><p>In order to look at the number of entries and the number of posts by programming language, we need to make use of the .groupby() method.</p><p>The key is combining .groupby() with the TAG column, which holds our categories (the names of the programming languages).</p><p>If we .sum() the number of posts then we can see how many posts each programming language had since the creation of Stack Overflow.</p><pre>df<strong>.</strong>groupby(&#39;TAG&#39;)<strong>.</strong>sum()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/232/1*tF6uLA4J6G4MZzDrkGrF8Q.png" /></figure><p>If we .count() the entries in each column, we can see how many months of entries exist per programming language.</p><pre>df<strong>.</strong>groupby(&#39;TAG&#39;)<strong>.</strong>count()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/264/1*l-cfZwUjWzqNb987WGjknw.png" /></figure><p>Let’s use Pandas’ to_datetime() to convert the entire df[&#39;DATE&#39;] column.</p><pre>df<strong>.</strong>DATE <strong>=</strong> pd<strong>.</strong>to_datetime(df<strong>.</strong>DATE)<br>df<strong>.</strong>head()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/352/1*rhhg-weukJxsry2wPX5WIg.png" /></figure><p>Now we can start thinking about how to manipulate our data so that we get one column per programming language.</p><p>We want to <strong>pivot </strong>the df DataFrame so that each row is a date and each column is a programming language.</p><p>We store the result under a variable called reshaped_df.</p><pre>reshaped_df <strong>=</strong> df<strong>.</strong>pivot(index<strong>=</strong>&#39;DATE&#39;, columns<strong>=</strong>&#39;TAG&#39;, values<strong>=</strong>&#39;POSTS&#39;)</pre><p>To examine the dimensions of the reshaped DataFrame.</p><pre>reshaped_df<strong>.</strong>shape</pre><pre>(145, 14)</pre><p>We have 145 rows and 14 columns in the new DataFrame. Each programming language became a column and our date column became the new index (i.e., the label for the rows).</p><p>Print out the column names:</p><pre>reshaped_df<strong>.</strong>columns</pre><pre>Index([&#39;assembly&#39;, &#39;c&#39;, &#39;c#&#39;, &#39;c++&#39;, &#39;delphi&#39;, &#39;go&#39;, &#39;java&#39;, &#39;javascript&#39;,&#39;perl&#39;, &#39;php&#39;, &#39;python&#39;, &#39;r&#39;, &#39;ruby&#39;, &#39;swift&#39;],<br>      dtype=&#39;object&#39;, name=&#39;TAG&#39;)</pre><p>Examine the head and the tail of the DataFrame. What does it look like?</p><pre>reshaped_df<strong>.</strong>head()<br>reshaped_df<strong>.</strong>tail()</pre><p>Count the number of entries per column:</p><pre>reshaped_df<strong>.</strong>count()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/207/1*n60_ZF2EmaEy5hTipt3nTQ.png" /></figure><p>When we count the number of entries per column we see that not all languages are the same. The reason is that the .count() method excludes NaN values. When we pivoted the DataFrame the NaN values were inserted when there were no posts for a language in that month (e.g., Swift in July 2008).</p><p>In this case, we don’t want to drop the rows that have a NaN value. Instead, we want to substitute the number 0 for each NaN value in the DataFrame. We can do this with the .fillna() method.</p><pre>reshaped_df.fillna(0, inplace=True)</pre><p>The inplace argument means that we are updating reshaped_df. Without this argument we would have to write something like this:</p><pre>reshaped_df = reshaped_df.fillna(0)</pre><p>Let’s check if we successfully replaced all the NaN values in our DataFrame.</p><pre>reshaped_df<strong>.</strong>head()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/1*lw5z_lkErqhsEt0ak9fTJw.png" /></figure><p>We can also check if there are any NaN values left in the entire DataFrame with this line:</p><pre>reshaped_df<strong>.</strong>isna()<strong>.</strong>values<strong>.</strong>any()</pre><pre>False</pre><p>Now we’re all set to create some charts and visualize our data.</p><p>To create our first charts we’re going to use a library called <a href="https://matplotlib.org/"><strong>Matplotlib</strong></a><strong>.</strong> There are many different libraries in Python to help us create charts and graphs. Matplotlib is an incredibly popular one and it works beautifully in combination with Pandas, so let’s check it out.</p><p>First, we have to import Matplotlib.</p><pre><strong>import</strong> matplotlib.pyplot <strong>as</strong> plt</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7b208528525d29ff04fab752065023d5/href">https://medium.com/media/7b208528525d29ff04fab752065023d5/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/976/1*ZQ6wLrDvw_P0OYur7NPZGQ.png" /></figure><p>But what if we wanted to plot all the programming languages on the same chart? We don’t want to type out .plot() a million times, right? We can actually just use a for-loop:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/daa6bfcb909b5045bfc67f893dcaeb85/href">https://medium.com/media/daa6bfcb909b5045bfc67f893dcaeb85/href</a></iframe><p>We should now see something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/976/1*xaDsj4cV7Le2MFCxvQxLtw.png" /></figure><p>In this data science project, we’ve seen how to grab some raw data and create some interesting charts using Pandas and Matplotlib.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9e19e5c006b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating one fun game with Flask]]></title>
            <link>https://medium.com/@shabnamhamidi1993/creating-one-fun-game-with-flask-b7e24059914c?source=rss-49976dd129fd------2</link>
            <guid isPermaLink="false">https://medium.com/p/b7e24059914c</guid>
            <dc:creator><![CDATA[Shabnam Hamidi Moghaddam]]></dc:creator>
            <pubDate>Wed, 12 Oct 2022 14:37:38 GMT</pubDate>
            <atom:updated>2022-10-17T13:38:23.441Z</atom:updated>
            <content:encoded><![CDATA[<p>We will build a web application quickly and easily using only a single Python file with <a href="https://flask.palletsprojects.com/en/2.2.x/quickstart/">Flask</a>.</p><p>I extremely encourage you to read this <a href="https://flask.palletsprojects.com/en/2.2.x/quickstart/">linked </a>document to be familiar with one of the best tools ever.</p><p>First of all, we create a new project called <strong>higher-lower</strong>, and add a <strong>server.py</strong> file to it.</p><p>We can start creating some HTML. The perfect thing that is flask actually accepts HTML in the return.</p><p>So we could just simply create a new Flask application where the home route displays an &lt;h1&gt; that says “Guess a number between 0 and 9” like below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cdc0a5220759eaf5ec5d87036e6cf4ed/href">https://medium.com/media/cdc0a5220759eaf5ec5d87036e6cf4ed/href</a></iframe><p>To make this project more fun, we can add a gif for this choice from <a href="https://giphy.com/">giphy.com</a>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9063e601ee4f70038c87304bd6fce8fe/href">https://medium.com/media/9063e601ee4f70038c87304bd6fce8fe/href</a></iframe><p>We generate a random number between 0 and 9. To do this we import random modules as well.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d8a089a4814f698f3784d19ba134ab9c/href">https://medium.com/media/d8a089a4814f698f3784d19ba134ab9c/href</a></iframe><p>we create a route that can detect the number entered by the user and check that number against the generated random number.</p><p>If the number is too low, tell the user it’s too low, same with too high, or if they found the correct number. try to make the &lt;h1&gt; text a different color for each page.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fd177d63042e4e41b912f95412ce5c46/href">https://medium.com/media/fd177d63042e4e41b912f95412ce5c46/href</a></iframe><p>e.g. If the random number was 6:</p><p>5 is too low:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/430/1*LCJg1X75Nj2SKaLOKd5wVw.png" /></figure><p>9 is too high:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/406/1*Uy2Xjv65Kl3RqeBO0DgwHA.png" /></figure><p>and 6 is just right.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/544/1*gyARTDQskc9hU2BWx76CKw.png" /></figure><p>You can access this code from my <a href="https://github.com/shbnm93/Higher-lower-Game">Github</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b7e24059914c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[House Prices Prediction with Regression and Web Scraping]]></title>
            <link>https://medium.com/@shabnamhamidi1993/house-prices-prediction-with-regression-and-web-scraping-b81d4d3b58e2?source=rss-49976dd129fd------2</link>
            <guid isPermaLink="false">https://medium.com/p/b81d4d3b58e2</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[regression]]></category>
            <category><![CDATA[beautifulsoup]]></category>
            <category><![CDATA[request]]></category>
            <category><![CDATA[web-scraping]]></category>
            <dc:creator><![CDATA[Shabnam Hamidi Moghaddam]]></dc:creator>
            <pubDate>Thu, 13 Jan 2022 12:04:36 GMT</pubDate>
            <atom:updated>2022-01-13T12:04:36.879Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi everyone, I want to announce that my team and I just finished our second project of Data Science Bootcamp at <a href="https://medium.com/u/e49b1fd56ade">İstanbul Data Science Academy</a> which is sponsored by <a href="https://medium.com/u/ee47a144e0c1">Hepsiburada</a> in Istanbul.</p><h3>Introduction</h3><p>In this project, we predict the house price of one important district of Istanbul city in Turkey that is called “Kadikoy” and we create a model using Machine Learning with regression and web scraping to find out which features affect the house price and is it possible to estimate the price using these features in the Kadikoy district?</p><p>Data has been scraped from <a href="https://www.zingat.com/">zingat.com</a> and we will develop regression models with the scraped data.</p><p>The Python libraries that we will use for this project <em>are NumPy, pandas, seaborn, matplotlib, scikit-learn, requests, and beautifulsoup.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PFXibCOm-nArBnKdJd-0gg.jpeg" /></figure><p>First of all, let me reference this <a href="https://books.google.com.tr/books/about/Practical_Web_Scraping_for_Data_Science.html?id=rkBWDwAAQBAJ&amp;printsec=frontcover&amp;source=kp_read_button&amp;hl=en&amp;redir_esc=y#v=onepage&amp;q&amp;f=false"><strong>book</strong></a> for explaining what is web scraping:</p><blockquote>Web “scraping” (also called “web harvesting,” “web data extraction,” or even “web data mining”), can be defined as “the construction of an agent to download, parse, and organize data from the web in an automated manner.” Or, in other words: instead of a human end user clicking away in a web browser and copy-pasting interesting parts into, say, a spreadsheet, web scraping offloads this task to a computer program that can execute it much faster, and more correctly, than a human can.</blockquote><p>We must import the packages via Python’s import command:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/485/1*AsIsOCye0YAzlBxaZ-f1Ow.png" /></figure><p>The first process of web scraping is <strong>getAndParseURL </strong>and this will allow us to access the HTML code of the given URL web page we want.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/1*VV3oIvmJhbUXgrLv0MDvgg.png" /></figure><p>We have 42 pages for scrap and to reach the information of these pages, we need to send requests to all web pages one by one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/1*RzehYfKMpyA0T78BwRhcFw.png" /></figure><p>Now we must get every house links to access the details. To quickly find the pieces of content we’re looking for, we can right-click any element on a web page and press “<strong>Inspect</strong>” to immediately highlight its corresponding HTML code in the Elements tab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4Wn3x66LVNPE3Jug-1edaw.png" /></figure><p>To access all links on all pages we will use the <strong>findAll</strong>() command. This will allow us to access the text inside the HTML tags. we will write a code like below and put it in a for loop to get this link from all house ads.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/986/1*ztECi9zzLWAkHid5CNyroA.png" /></figure><p>Now we have the house ad’s links, so we determine which house features we want to get. In this example, we will get the features in the red circles shown below. These features are;</p><ul><li>Ad’s Name</li><li>Neighborhood’s Name</li><li>Price</li><li>Net Square Meters</li><li>Gross Square Meters</li><li>Number of Room and Hall</li><li>Number of Bath</li><li>Number of Photo Belongs to Ad</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/623/1*z19jHL5mH7K5WSD8chydhA.png" /></figure><p>We pulled the features that we will load into the columns from the page and created our data frame.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1018/1*2EnNGGBYR01Lhkc8IS9Z1A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/806/1*d_-zo0JbCqzBOM5WKf5TZA.png" /></figure><p>When we print information about the DataFrame we figure out that we have some columns that have null values. Because most of the machine learning models that we want to use will provide an error if we pass NaN values into it. The easiest way is to just fill them up with 0, but this can reduce our model accuracy significantly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/452/1*uE50UK-xPy3gnkQG1tSoGQ.png" /></figure><p>For filling missing values, there are many methods available. For choosing the best method, we need to understand the type of missing value and its significance, so we decide to fill them with a median of each column.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/466/1*zbT-Xr22DF8hUBOGKJJFRw.png" /></figure><p>After investigating the data we decide to delete the missing values of the “ODA-SALON SAYISI” column.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/485/1*H1fC5XuR-N0mFcKo5a7mrQ.png" /></figure><p>So our DataFrame information is like below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/458/1*2ChFMvVmUm35WqDZing_Ww.png" /></figure><p>To utilize data in the regression model we must convert object data types to integers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/807/1*95Hu3MCF6DplG5wzMvyDQQ.png" /></figure><p>Let’s see how many districts we have in Kadikoy and use <strong>get_dummies</strong> to convert a categorical variable into dummy/indicator variables for the “MAHALLE” column. Also, we drop the “ODA-SALON SAYISI” and “İLAN ADI” columns, because they’re unnecessary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1015/1*ZUAfPuxQbSAPJF3eaArBaA.png" /></figure><p>When we sort the price of the house, we figure out that some of them are wrong values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/999/1*D5rUX5DjOqoSbnuxO-l9AA.png" /></figure><p>so we try to correct them like below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1007/1*I0IHZx0o2przDS4CoHD95A.png" /></figure><p>After data cleaning which is the important part of analyzing, let’s see the price distribution:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/996/1*8mTMXssr20g-mPE74-nhcg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JkZjicm8k--jWyccy-vIsA.png" /></figure><p>To see the distribution and top 10 districts with the highest average house prices we create this chart.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/799/1*GIwGyWHyff3Vn0EnlVZVhg.png" /></figure><p>To see the distribution of the number of rooms and halls we create this chart as below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*3aJBam1WX2HygsUc6vvakA.png" /></figure><p>To see the distribution of the number of bathrooms we create this chart as below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*A6VQf3CknxWY6K29CEwWqg.png" /></figure><p>To see the correlation matrix of house features we create a correlation heatmap<strong> </strong>Chart, as below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/804/1*SwdDID_kGzSWR7tIowXoaA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/810/1*-DCv07YQn6G-Zj1NpiJ4Vw.png" /></figure><p>To see the correlation matrix of the districts where the house is located, we figure out that “Caddebostan” and “Fenerbahçe” were more expensive districts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/799/1*iwqQMOaEZU77JfRrShKgWg.png" /></figure><p>To visualize with <strong>Seaborn:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*zSo3zt-Wk2vQgkW6--Aw6Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O66rRBjDHGRXqzjeCOE1ig.png" /></figure><p>Now let’s talk about <strong>Linear Regression</strong>:</p><p>First of all import the packages via Python’s import command:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*Elxa9dY0DiN16J8yIeNN_Q.png" /></figure><p>After the data overview, now we know which columns are feature variables and which are target variables. The size of testing data is 20%.</p><p>We used <strong>R2-Score</strong> and <strong>MSE</strong> as evaluation metrics in model prediction and made it for <strong>train-validation-test (%60-%20-%20).</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/1*UWEJ8qmZjckz_KTDG3qI5w.png" /></figure><p>Model algorithm: <strong>Linear</strong> Regression</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/799/1*BHrjHyIsAS-myQ18tV3Wiw.png" /></figure><p>Model algorithm: <strong>Ridge</strong> Regression</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/732/1*IGr6LguXWaVo5AXbOVt-4Q.png" /></figure><p>Model algorithm: <strong>Lasso</strong> Regression</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/725/1*RLerTg-JzykG3zqqCdPevg.png" /></figure><h3>Conclusion</h3><p>According to analysis, the features that most positively affect the price of a house in Kadıkoy are;</p><ul><li>The <strong>square meter</strong> of the house.</li><li><strong>A number of rooms and living rooms</strong> of the house.</li><li>The house is located in <strong>Caddebostan</strong> or <strong>Fenerbahce</strong>.</li><li>The best regression method is shown <strong>Linear Regression</strong> and <strong>Lasso Regression</strong>.</li></ul><h3>Future Work</h3><p>What can we do to improve the prediction model?</p><ul><li>Scanning the house data in <strong>a larger area</strong>.</li><li>Working with <strong>more features</strong>.</li><li>Doing more extensive <strong>feature engineering</strong> on features.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b81d4d3b58e2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Metropolitan Transportation Authority (MTA): My 1st Data Science project-WomenTechWomenYes]]></title>
            <link>https://medium.com/i%CC%87stanbuldatascienceacademy/metropolitan-transportation-authority-mta-my-1st-data-science-project-womentechwomenyes-dd7f7b74d8f7?source=rss-49976dd129fd------2</link>
            <guid isPermaLink="false">https://medium.com/p/dd7f7b74d8f7</guid>
            <category><![CDATA[projects]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[nyc]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data]]></category>
            <dc:creator><![CDATA[Shabnam Hamidi Moghaddam]]></dc:creator>
            <pubDate>Tue, 30 Nov 2021 22:00:38 GMT</pubDate>
            <atom:updated>2021-12-06T10:54:57.716Z</atom:updated>
            <content:encoded><![CDATA[<p>My team and I just finished our first project at <a href="https://medium.com/u/e49b1fd56ade">İstanbul Data Science Academy</a> in Istanbul. I’m glad to complete a real-world project specifically designed to showcase our learned data scientists skills.</p><p>There is a fictional organization, WomenTechWomenYes (WTWY), which promotes the participation of women in technology. WTWY holds an annual gala in early summer and they are looking to collect email addresses and send tickets to a free gala by placing street teams at subway entrances in New York city. So the purpose of this project is determining the busiest metro stations, the busiest day and the busiest hour.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*d_r99Q2onPzkZCIL" /><figcaption>Photo by <a href="https://unsplash.com/@jngabo?utm_source=medium&amp;utm_medium=referral">Joseph Ngabo</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4><strong>The Method:</strong></h4><p>The dataset that we worked with is the <a href="http://web.mta.info/developers/turnstile.html">MTA Turnstile Data</a> which is publicly available online. The gala takes place in early summer, so we decided to use 1 March 2021 - 31 May 2o21.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*wEGVHX9MAmRFrTyrQ0fBGQ.png" /></figure><p>The following Python libraries are essential for Exploratory Data Analysis: Pandas, Numpy, Seaborn, and Matplotlib.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2RLZPPE9_GrUqHIdBd0S7A.jpeg" /></figure><p>We must first import the packages via the Python&#39;s <strong>import</strong> command:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/428/1*4zW8UbG6GM2cp0av2CdzRQ.png" /></figure><p>Taking the first 5 rows of the data by writing the code will be as following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/704/1*9Eb1oVf8LBU1rU0WR5Acmw.png" /></figure><p>The descriptions of the column features are given <a href="http://web.mta.info/developers/resources/nyct/turnstile/ts_Field_Description.txt">here</a>.</p><p>Before analyzing the data, it’s important to make sure the data is clean. analyzing bad or dirty data could cause to reach the wrong conclusions and implement ineffective changes.</p><p>As you see in the <strong>TIME</strong> column, the readings occur every 4 hours.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/777/1*-mYefPrGY4sQmgA9XHrFLA.png" /></figure><p>We create a new column that is called <strong>TURNSTILE</strong> by aggregating the <strong>C/A</strong>, <strong>UNIT</strong> and <strong>SCP</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/898/1*moO9txhC5E99Ot7lbuEa0Q.png" /></figure><p>At the <strong>ENTRIES</strong> and <strong>EXITS</strong> columns we must subtract the <em>previous</em> one and the next one to know how many entries there were at a given observation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/709/1*wcD8lKSiqtW2eg2gf5RSXg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*mg8X8IZAKYacW_1zN3v9OQ.png" /></figure><p>We combine the <strong>DATE</strong> and <strong>TIME</strong> fields into a string and convert it into a <strong>DATETIME</strong> object.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/775/1*VsBYp8qMwEfbladO8aQEqQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_wV4BSQetNASpliY8QlGGQ.png" /></figure><p>To find that which station has the most traffic, we aggregate the <strong>d_Entries</strong> and <strong>d_Exits</strong> columns and create the <strong>TRAFFIC</strong> field.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YbW-nSmaNqD5bPcaStmvcg.png" /></figure><p>After drop columns that we don’t need, we create a new column of <strong>WEEK</strong> to represent the days.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/959/1*GMNXoVDpXoSgc5Subq65lA.png" /></figure><p>It’s important to make sure our data is clean so that our eventual analysis will be correct.</p><h4><strong>The Result:</strong></h4><p>The most busiest station is <strong>34 ST-PENN STA </strong>and the most busiest day is <strong>Friday</strong> as is shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wPzJPUbwmZU90r-4GBiw2g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f4o4_T_bbFVhFOzIRYJU2g.png" /></figure><p>For showing the most busiest time we use <strong>Pie Chart</strong> and with the <strong>heatmap</strong> we can see the best option according to MTA data is <strong>34 ST-PENN STA</strong> station on <strong>Friday</strong> at <strong>12:00–16:00</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kUMyvF5dFPHuiP18wJGuoA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3hrJ-VXVQXAdcMEOFdKbtg.png" /><figcaption>Busiest days and times for 34 ST-PENN STA station</figcaption></figure><p>We use additional data of <strong>New York Census Data</strong> and we find out that those with higher income are more likely to donate and Females may be more interested in the event than Males.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C5jke4eZ5H1btb-vIQKVBw.png" /><figcaption>The best option according to the number of woman in NYC Census data is Brooklyn and Queens</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x0CpBxj89Vicz7rK8jMEqw.png" /><figcaption>The best option according to the average per capita income in NYC Census data is Manhattan.</figcaption></figure><h4><strong>The Conclusion:</strong></h4><p>According to the analysis, the busiest station is shown 34 ST-PENN STA station and the busiest day is Friday.</p><p>The busiest time is shown 12:00–16:00 and the best option is Friday in 34 ST-PENN STA station.</p><p>The best option according to the number of woman in NYC Census data is Brooklyn and Queens. The average per capita income in NYC Census data is Manhattan.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd7f7b74d8f7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/i%CC%87stanbuldatascienceacademy/metropolitan-transportation-authority-mta-my-1st-data-science-project-womentechwomenyes-dd7f7b74d8f7">Metropolitan Transportation Authority (MTA): My 1st Data Science project-WomenTechWomenYes</a> was originally published in <a href="https://medium.com/i%CC%87stanbuldatascienceacademy">İstanbul Data Science Academy</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>