<?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 Tanay Mehta on Medium]]></title>
        <description><![CDATA[Stories by Tanay Mehta on Medium]]></description>
        <link>https://medium.com/@heyytanay?source=rss-a08cc379167------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*YR4DhjQNJzDxNqY6.jpg</url>
            <title>Stories by Tanay Mehta on Medium</title>
            <link>https://medium.com/@heyytanay?source=rss-a08cc379167------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 13:57:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@heyytanay/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[How to get 104 hour long “Industry Recognized Data Science Certification” for FREE.]]></title>
            <link>https://medium.com/@heyytanay/how-to-get-104-hour-long-industry-recognized-data-science-certification-for-free-3f7972a25890?source=rss-a08cc379167------2</link>
            <guid isPermaLink="false">https://medium.com/p/3f7972a25890</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[free]]></category>
            <category><![CDATA[free-course]]></category>
            <dc:creator><![CDATA[Tanay Mehta]]></dc:creator>
            <pubDate>Wed, 03 Jul 2019 12:37:25 GMT</pubDate>
            <atom:updated>2019-07-03T12:37:25.725Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cHHEamoezOuNg5GdxvEyvg.jpeg" /><figcaption>For Representational purpose only. Photo by <a href="https://unsplash.com/@nitishm?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Nitish Meena</a> on <a href="https://unsplash.com/t/nature?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h3>Prologue</h3><p>For the past few months, I am noticing a lot of Students (mainly from the stream of Bachelor’s of Technology in Computer Sciences and Computer Applications; wasting their parents hard-earned money on these so called “Data Science Coaching/training ” both online and offline.</p><p>Such repeated incidents made me think, that education is meant to be free and accessible for everyone and anyone and one should try as much as possible to gather the same knowledge without coughing up unnecessary cash.</p><p>So, I began on a journey to find out online Certification courses that can achieve this for any student regardless of there financial Status.</p><p>And as soon as I started this journey, I found it! Yes I did! Now follow along this Blog Post, because this blog might prove to be one of the most (if not the most) life-changing blogs of your journey.</p><h3>The Shorter Version (TL;DR)</h3><p>**Bear in mind: This Post is only Relevant until this Datacamp subscription is offered by Visual Studio as a part of Dev-essentials. If you did not find the Datacamp offer in your Visual Studio Dev Essential Section, please post it as a comment down below, Cheers!**</p><p>“Only For those who are in hurry, be known that you will miss some important tips on how to complete the course in time”</p><ol><li>Got to <a href="https://visualstudio.microsoft.com/dev-essentials/"><em>Visual Studio Dev Essentials</em></a><em> </em>and sign up using either of your Microsoft<em> </em>or Github account<em>.</em></li><li>Make sure you have worked your way past the ‘Sign-in’ related section.</li><li>Once you are in, you will see something like this:</li><li>Now, in the Datacamp Card, click at <strong>“Activate”</strong></li></ol><p>5. Follow the instructions to set up your account and you will now have your Free 2 months Datacamp subscription without even needing your Credit Card.</p><p>6. Follow me on <a href="https://linkedin.com/in/tanaymehta28"><strong><em>LinkedIn</em></strong></a>, <a href="https://github.com/heytanay"><strong><em>Github</em></strong></a><strong><em> </em></strong>and be sure to give some generous claps 😂.</p><h3>The Slightly longer version (WR)</h3><p>I will not try to waste your time anymore and show you some steps straight away.</p><p>In this post, we shall activate DataCamp’s 2 month Subscription for FREE, without needing a Credit Card.</p><p>The Steps of activating the Datacamp subscription is really all the same as described in the Short Version Above. However, In this “<strong>slightly</strong>” longer version, I will tell you one more thing, which is how to complete the course on time and managing studies like a pro.</p><h4>Steps to Activate the Subscription</h4><p>1. Go to <a href="https://visualstudio.microsoft.com/dev-essentials/"><em>Visual Studio Dev Essentials</em></a><em> </em>and sign up using either of your Microsoft<em> </em>or Github account<em>.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y7Q9IH5khaLinzHjBYhg_A.png" /></figure><p>2. Make sure you have worked your way past the ‘Sign-in’ related section.</p><p>3. Once you are in, you will see something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s7trEOf0EXFPHbA0q_MOzA.png" /></figure><p>4. Now, in the Datacamp Card, click at “Activate”</p><p>5. Follow the instructions to set up your account and you will now have your Free 2 months Datacamp subscription without needing your Credit Card.</p><p>Now, you know how to activate the offer! Let’s turn our focus on how to actually complete it in time:</p><h4>Time Management</h4><p>The key to completing course in time is <strong>Persistence and Consistency. </strong>If you can devote at the very maximum, 4 hours a day to each and every course (the time is obviously an average statistic over 26 days. Some ups and downs are okay), you can complete this course in around 26–27 days with around an average of <strong><em>1 Course Per Day</em></strong>, also considering that some 5-hour long courses take less than 3 hours to complete and some 3-hours ones might take you the whole day to fully understand.</p><p>The Numbers above obviously depend on how fast can you grasp concepts and what not factors. I however, shall provide you a general statistic, which has been done.</p><h4>Why the <a href="https://en.wikipedia.org/wiki/Hell">Hell</a> do I have the 1 Month of Subscription still left?</h4><p>Now, the subscription you activated lasts about 2 months and my above strategy, if followed with very less error, will have you complete the course in around 27 days.</p><p>Question is: Why should I do of the remaining 31–32 days?</p><p>Answer: Your Choice. You can either:</p><ol><li>Practice and make projects at Datacamp itself. or,</li><li>You can pursue other courses at Datacamp.</li><li>Do whatever you wish, it’s your bloody life! 😂</li></ol><p>From a personal perspective, I completed the course in 27 days and got the final certificate along with all the individual 26 certificates that I got along the way.</p><p>You can view all my certificates here; <a href="http://www.tanaymehta.ml/certs.html"><strong><em>Tanay Mehta | The Portfolio</em></strong></a></p><p>And this marks the end of this post gentlemen! Thank you all for reading!</p><p>If you like this post, Please make sure to give some generous claps and also Share it with your friends and colleagues!</p><p>You can connect with me on <a href="https://www.linkedin.com/in/tanaymehta28/"><strong><em>LinkedIn</em></strong></a><strong><em>, </em></strong>view my <a href="http://tanaymehta.ml/"><strong><em>Portfolio</em></strong></a> and follow my projects on<strong><em> </em></strong><a href="https://github.com/heytanay"><strong><em>Github</em></strong></a>.</p><p>Once again, Thank you gentlemen for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3f7972a25890" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data Science Adventures #1 — Spanish High speed Train Dataset]]></title>
            <link>https://medium.com/@heyytanay/data-science-adventures-1-spanish-high-speed-train-dataset-c690acf18b0a?source=rss-a08cc379167------2</link>
            <guid isPermaLink="false">https://medium.com/p/c690acf18b0a</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[visualization]]></category>
            <category><![CDATA[pandas]]></category>
            <category><![CDATA[data-visualization]]></category>
            <dc:creator><![CDATA[Tanay Mehta]]></dc:creator>
            <pubDate>Sat, 29 Jun 2019 10:12:56 GMT</pubDate>
            <atom:updated>2019-06-29T10:49:12.058Z</atom:updated>
            <content:encoded><![CDATA[<h3>Data Science Adventures #1 — Spanish High speed Train Dataset</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HydOFhyvnn5xugD1Unjazw.jpeg" /><figcaption>Image for Representational purpose only. Photo by <a href="https://unsplash.com/@charles_forerunner?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Charles Forerunner</a> on <a href="https://unsplash.com/search/photos/train-station?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h4>Prologue</h4><p>They say Data is the new Oil and getting your hands onto this piece of oil is easier than ever. So I thought, maybe let’s start a Data Science Adventure series where we shall explore trending datasets around the wilderness of internet and do some <a href="https://towardsdatascience.com/exploratory-data-analysis-8fc1cb20fd15"><strong><em>Exploratory Data Analysis</em></strong></a> on them so that we can learn the story, the data wants to tell.</p><p>I have seen many of the Data Science Blogs these days just getting a Dataset, cleaning it a little bit and then shoving it into a Dense Neural Network and then getting some output that they don’t even know what means.</p><p>We shall refrain from such practices, in the Data Science Adventure Series, we will explore the Data, clean it a bit and then try to see the story the Data wants to be told. Just that. I promise.</p><p>P.S: For those Machine Learning Geeks out there, please know that I will be starting a separate Machine Learning / Deep Learning Series on cutting-edge techniques in the field. But for the time being, get a bit educated with the Data!</p><h4><a href="https://www.kaggle.com/thegurus/spanish-high-speed-rail-system-ticket-pricing">Spanish High Speed Rail tickets pricing Dataset</a></h4><p>A little information about the Dataset;</p><p>The dataset has been scrapped by <a href="https://thegurus.tech/"><strong><em>The Gurus</em></strong></a>, a team of Data Scientists named Pedro Muñoz and David Cañones.</p><p>It has only 1 CSV file called ‘renfe.csv’ which is ~271 MB in size.</p><p>It’s content are:</p><ul><li><strong>insert_date</strong>: date and time when the price was collected and written in the database, scrapping time (UTC)</li><li><strong>origin</strong>: origin city</li><li><strong>destination</strong>: destination city</li><li><strong>start_date</strong>: train departure time (European Central Time)</li><li><strong>end_date</strong>: train arrival time (European Central Time)</li><li><strong>train_type</strong>: train service name</li><li><strong>price</strong>: price (euros)</li><li><strong>train_class</strong>: ticket class, tourist, business, etc.</li><li><strong>fare</strong>: ticket fare, round trip, etc.</li></ul><p>In a typical prediction scenario, we would usually predict the outcome based on the independent features, for an instance, in this case: We could predict the ‘price’ of the trip in Euros based on all the other independent features.</p><p>However, in this Data Science Series, we shall focus Exploratory Data Analysis and Feature Engineering.</p><h3>Bootstrapping the Code</h3><p>Let’s start our journey by Importing some useful modules and the dataset itself.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b863b4be52640059702866ba54f9d6b8/href">https://medium.com/media/b863b4be52640059702866ba54f9d6b8/href</a></iframe><p>Also, let’s view the top five entries in the dataset;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lV7MwpGzXjPb6c49trAzig.png" /><figcaption>Raw Imported Dataset</figcaption></figure><p>Now, there are many problems in the Dataset: Unwanted Columns, NaN values, Categorical values and Datetime values. Let’s deal all of them one by one.</p><h4>Let’s Drop all the Unwanted Columns first</h4><p>The Columns “insert_date” and “Unnamed: 0” are not useful as:</p><ol><li>We don’t need to “insert_date” to be analysed as it was fed in when the specific Data was inserted in by the data scraper algorithm.</li></ol><p>2. We also don’t need “Unnamed: 0” as it is a false index column</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e45c5ec39bbe23307b09e16e13bccc38/href">https://medium.com/media/e45c5ec39bbe23307b09e16e13bccc38/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EHp-XyZqsCfwxBxww0Nu6w.png" /><figcaption>Successfully dropped the Unwanted Columns</figcaption></figure><h3>Now let’s deal with NaN (Not a Number) values in the Dataframe</h3><p>The <strong>NaN</strong> property represents “Not-a-Number” <strong>value</strong>. This property indicates that a <strong>value</strong> is not a legal number and thus cannot be allowed in a dataset.</p><p>First, let’s check the number of NaN values in the Dataset;</p><p>We will use the command:</p><pre>df.isna().sum()</pre><p>The above code will sum up all the NaN values in all columns of the Dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CHV3oj0nmAUkf3tNeu5gzw.png" /><figcaption>You can see NaN values corresponding to the Column</figcaption></figure><p>So, there are total of 310,681 NaN values in ‘price’ column and 9664 NaN values in the ‘train_class’ and ‘fare’ columns as well.</p><p>Now there are three approaches to this problems:</p><ol><li>Either we drop all the NaN entries in the dataset</li><li>Or we drop only the ‘train_class’ and ‘fare’ columns as they have less NaN values than ‘price’ column — in this approach, we will replace NaN values in the ‘price’ column by the average of all columns (the mean of them)</li><li>Or we don’t drop any columns and just take average of all of them separately and replace NaN values accordingly.</li></ol><p><strong><em>We are going to take the 2nd Approach </em></strong>as it will suite our use-case the most.</p><p>First we make a <a href="https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.copy.html"><em>deep copy</em></a> of our original dataset so that if mess somewhere up, we don’t have to re-import the whole 271 MB Dataset again.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a35523bc7885a5c04240f96aafbd5ef8/href">https://medium.com/media/a35523bc7885a5c04240f96aafbd5ef8/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CBIoU-7j96K9Geekrgi1YQ.png" /><figcaption>Replaced the NaN values in ‘price’ column with the mean of column</figcaption></figure><p>This was very convenient as the values in “price” column were Numerical.</p><p>But the values in “train_class” and “fare” are categorical. Dropping them, now since there are only 9664 values; dropping them won’t be that of a bummer!</p><p>Now let’s drop NaN values in remaining columns;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xf7kERmTLNFTV99NWWEPYA.png" /><figcaption>Cool: So there are no NaN values remaining in the Dataset!</figcaption></figure><h3>Now let’s Plot our Data one by one</h3><p>First, we shall plot the ‘origins’ column in a bar plot to see which city tops the list!</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dec19d40ca263cff9512ea21a723b1d9/href">https://medium.com/media/dec19d40ca263cff9512ea21a723b1d9/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/925/1*lTEPu1y3lbzPUV_fUdgvlQ.png" /><figcaption>Trains originating frequency v/s number of trains</figcaption></figure><p><strong>Insight: </strong>As you can see from above, Most number of trains originate from Madrid, Barcelona, Sevilla, Valencia and Ponferrada.</p><p>Now let’s Plot Train’s Destination Frequency by Cities</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ae6edca24d7e20eb0fa3747ce96cf6b1/href">https://medium.com/media/ae6edca24d7e20eb0fa3747ce96cf6b1/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/925/1*l0zCkQXBxMSSIXYBvpmqRg.png" /><figcaption>Trains destination frequency v/s number of trains</figcaption></figure><p><strong>Insight</strong>: The Above 2 Graphs indicate that Madrid is both the Destination and Origination spot for the majority of Trains. Infact, the Trains Arriving and Originating Distribution of the Trains are identical, which tells you a lot about the Data.</p><h3>Now let’s Clean the Data a bit.</h3><p><strong>We will first encode the categorical values:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/691be2a5449089098c46fe9a30243287/href">https://medium.com/media/691be2a5449089098c46fe9a30243287/href</a></iframe><pre>Output&gt;&gt; [‘BARCELONA’, ‘PONFERRADA’, ‘VALENCIA’, ‘MADRID’, ‘SEVILLA’]</pre><p>Now let’s replace origin and destination by making a simple but generalized function.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/09bd0a6a337b17788e050a7ef5a4cc8f/href">https://medium.com/media/09bd0a6a337b17788e050a7ef5a4cc8f/href</a></iframe><p><strong>Note</strong>: You might have noticed that we extracted the categorical_names (like names of cities) by just doing it on spot. Well, we will have to repeat it later, so I have made a generalized function to do just that below:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2db343ad81b320ac00ee4009b0ae4e9f/href">https://medium.com/media/2db343ad81b320ac00ee4009b0ae4e9f/href</a></iframe><p>However, we shall use it a bit later. But for now, let’s use our function <strong>“replace_small_categorical_data( )” </strong>below and replace those columns.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f9d15e2d731992457a3056e234b95234/href">https://medium.com/media/f9d15e2d731992457a3056e234b95234/href</a></iframe><p>As you can see below; It worked! Now the ‘destination’ column is numerical and not categorical.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MHQzrUV9Viy1RsP6_mfnMw.png" /><figcaption>Look at the ‘destination’ column</figcaption></figure><p>Now, let’s do the same with ‘origin’ column</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7e822dd15fcc48988e1f75a1a60d3e9f/href">https://medium.com/media/7e822dd15fcc48988e1f75a1a60d3e9f/href</a></iframe><p>Note: For those of you who haven’t noticed, I have made another new dataframe called “new_df_test” before; because, Why not?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D_i_z8JZzfuC-Tne9JtUtg.png" /><figcaption>Now the Origin column is encoded too!</figcaption></figure><h3>Let’s encode the remaining 3 columns too (train_type, train_class, fare)</h3><p>But before we do that, let’s actually visualize them to listen the story they want to tell.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/902a739aafa9d82d09ba7f8cd9a72fe1/href">https://medium.com/media/902a739aafa9d82d09ba7f8cd9a72fe1/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/925/1*23nXDRu2EqTzPwGgJfEVhA.png" /><figcaption>Train types v/s number of trains</figcaption></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d1bcab060d96757717af0434e0f6876a/href">https://medium.com/media/d1bcab060d96757717af0434e0f6876a/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/925/1*hxhMELL1WH_ivIIOpOAnMQ.png" /><figcaption>Train Classes v/s number of trains</figcaption></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3669a87430d7c1525241b1515c5ad3bd/href">https://medium.com/media/3669a87430d7c1525241b1515c5ad3bd/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/925/1*l9rt7Qo3gc6-DcFU80rjJQ.png" /><figcaption>Train fares v/s number of trains</figcaption></figure><h4>Now you saw the distributions, let’s encode those values!</h4><p>First let’s get the category names and encode them (this could be done in single loop easily but then it will be a little too complex to understand).</p><p>We are going to use both separate function we defined above.</p><p>First, we get the names of different categories from respective columns</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b251b43e9cf2cd9ea4aa5f38d5c64321/href">https://medium.com/media/b251b43e9cf2cd9ea4aa5f38d5c64321/href</a></iframe><p><strong>Important</strong>: If you are wondering what does “_” means, and why I haven’t used any other variable names (you must be beginner then!); we use “_” in python for a value we don’t care about. Python will not mind you doing that. In this case, I have no use for the first value that is returned by the function, which is the length of the Category names list.</p><p>Now we will pass the dataframe, the column name we wish to encode and the list of categorical names list (which we obtained from last bit of code) to the “<strong>replace_small_categorical_data( )</strong>” function and it will return the results.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/431f5eb5b08e8a9b10a32e984f7f61d5/href">https://medium.com/media/431f5eb5b08e8a9b10a32e984f7f61d5/href</a></iframe><p>Now, If everything ran exactly as it was supposed, we will have some output like this;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9cCeYDXgTgqXiPbh1GuPpQ.png" /><figcaption>If you look at the ‘train_type’, ‘train_class’ and ‘fare’ column, they are now encoded</figcaption></figure><p><strong>Note</strong>: If you are wondering how did I list random rows on the output; there is a function for that:</p><pre>dataframe.sample(number)</pre><p>If you use this function, by replacing ‘dataframe’ with your dataframe and ‘number’ by number of how many rows you want; you can get a certain number of rows randomly sampled from the dataset.</p><h3>To Homestretch!</h3><p>We are almost done now! on the homestretch, let’s actually deal with the elephant(s) in the room, i.e: ‘start_date’ and ‘end_date’ columns.</p><p>To do this, we will use the datetime module for conversion of start_date and end_date columns.</p><p>Why this conversion, you ask?</p><p>Because, At this point, it is hard to infer about the duration of the journey and the effect that ‘time’ of the journey has on the Price.</p><p>For that, we shall be converting Datetime indexes to simple and parsing-friendly numerical values.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5e9accdb5fca3fd27e1090b42fe100d7/href">https://medium.com/media/5e9accdb5fca3fd27e1090b42fe100d7/href</a></iframe><p>You can learn more about Datetime module in Python 3 <a href="https://docs.python.org/3/library/datetime.html"><em>here</em></a></p><p>What the above bit of code does, is that it first takes all the datetime values from both columns, parse them using Datetime format system, subtract them (remember; Total duration of trip = end_time — start_time). Then we are converting that to seconds using the function “.seconds( )” on the converted time.</p><p>We are thus adding the duration in seconds to a list and then making a new column in our Dataset from the list.</p><p>Now, the Dataset look something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*llMHmpozYrbV0Y8FeU5lIQ.png" /><figcaption>Notice the new ‘duration’ column (values in seconds)</figcaption></figure><p>Now let’s do the same for weekdays and thus we are done!</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c48009a0f62d654f7633b6b4b5b942d1/href">https://medium.com/media/c48009a0f62d654f7633b6b4b5b942d1/href</a></iframe><p>What above code does that; It iterates similar to one like seconds, but this time, we are adding the encoded weekdays in two different new columns, i.e; ‘week_start’ and ‘week_end’. These two columns have encoded value for both starting and ending of the week.</p><p>Now, the dataframe looks something like this;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1Ds1GEwVW1lExWqI1t2D5A.png" /><figcaption>Notice the new ‘week_start’ and ‘week_end’ columns</figcaption></figure><p>But we aren’t quite finished, there is still one thing remaining.</p><p>Which is: We still have the old ‘start_date’ and ‘end_date’ columns which are no longer useful as we have extracted all imported features from it.</p><p>So, let’s drop them and go home!</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0a82194e7922910c60fc0c8df8dce260/href">https://medium.com/media/0a82194e7922910c60fc0c8df8dce260/href</a></iframe><p>Now, the Dataset look something like this;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hMp-rdJ6GcVJIFHbJuNScg.png" /><figcaption>Notice how clean the Data now looks in comparison to before</figcaption></figure><p>And by this note, I would like to end the First Blog of our Data Science Adventure Series. You are now free to use the code from <a href="https://github.com/heytanay/data-science-adventures/blob/master/Spanish%20High%20Speed%20Rail%20Dataset%20EDA/Spanish%20High-speed%20Rail%20Dataset%20Analysis.ipynb"><strong><em>whole Notebook</em></strong></a> (with detailed Documentation in it) and tinkle around with functions I made!</p><p>If you like this post, Please make sure to give some generous claps and also Share it with your colleagues!</p><p>You can connect with me on <a href="https://www.linkedin.com/in/tanaymehta28/"><strong><em>LinkedIn</em></strong></a><strong><em> </em></strong>and follow me on<strong><em> </em></strong><a href="https://github.com/heytanay"><strong><em>Github</em></strong></a><strong><em>.</em></strong></p><p>I also want to credit <a href="https://www.kaggle.com/gauthamastro/spanish-high-speed-rail-price-prediction-using-dnn"><strong><em>this Chap</em></strong></a> for a major inspiration of EDA and Feature Engineering I showed in my Blog here.</p><p>Once again, Thank you gentlemen for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c690acf18b0a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>