<?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 Anagha on Medium]]></title>
        <description><![CDATA[Stories by Anagha on Medium]]></description>
        <link>https://medium.com/@anaghasridhar?source=rss-14ea94a6b9e2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*y1FbA6uxqv6m2C-kHfppuw.png</url>
            <title>Stories by Anagha on Medium</title>
            <link>https://medium.com/@anaghasridhar?source=rss-14ea94a6b9e2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 01:58:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@anaghasridhar/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[Leveraging the Power BI package on Jupyter Notebook]]></title>
            <link>https://anaghasridhar.medium.com/using-power-bi-onjupyter-notebook-c9719af869f2?source=rss-14ea94a6b9e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/c9719af869f2</guid>
            <category><![CDATA[jupyter-notebook]]></category>
            <category><![CDATA[power-bi-tutorials]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data-visualisation]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Anagha]]></dc:creator>
            <pubDate>Thu, 17 Jun 2021 17:13:41 GMT</pubDate>
            <atom:updated>2021-06-18T04:20:39.158Z</atom:updated>
            <content:encoded><![CDATA[<h3>View your Power BI Dashboard on Jupyter Notebook</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iPkGzhWjKkrPgzMO" /><figcaption>Photo by <a href="https://unsplash.com/@srd844?utm_source=medium&amp;utm_medium=referral">Stephen Dawson</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Microsoft’s Power BI, as its name suggests, is a powerful business analytical service that allows users to create interactive dashboards/reports. The user-friendly interface allows for quick, efficient, and aesthetically pleasing visualizations. Combine this with the ease of writing and running python codes on Jupyter Notebook for in-depth data exploration, we have an indispensable package.</p><p>Although Power BI dashboards could previously be embedded into Jupyter Notebooks, they weren’t interactive, nor could they be used to extract data from the visuals. With the new package, this and so much more can be done.</p><p>Let’s get into it!</p><h3>1. Create a Dashboard</h3><p>For the sake of this article, I’ve used a sample sales dataset to create a simple dashboard on Power BI desktop. In order to publish it, you will have to create <a href="https://powerbi.microsoft.com/en-us/power-bi-pro/">Power BI Pro</a> account using an institution/organisation email ID—although it is paid, there is a 60-day free trial option.</p><p>When logged in, you will see a homepage with a navigation panel towards the left of the screen. At the bottom of that, there should be a ‘Workspaces’ option. Create a new workspace, give it a name and short description.</p><p>Once done, go back to your Power BI desktop app and sign in to your account. You can now publish your dashboard under the name of the workspace you created. It will be shown, along with your dataset, in the Power BI web app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b0nW_Ninc-wODMDBCGPwiA.png" /><figcaption>Power BI web app</figcaption></figure><h3>2. Embedding it into Jupyter Notebook</h3><p>The first step is to download the package onto your system. Do this by running the following code in your terminal.</p><pre>pip install powerbiclient</pre><p>Once done, open a Jupyter Notebook file and run the following codes:</p><pre>from powerbiclient import Report, models</pre><pre># Import the DeviceCodeLoginAuthentication class to authenticate against Power BI<br>from powerbiclient.authentication import DeviceCodeLoginAuthentication</pre><pre># Initiate device authentication<br>device_auth = DeviceCodeLoginAuthentication()</pre><p>After running the device_auth code, you will get a message asking you to open a Microsoft URL, authorise it using the unique code given and sign into your Power BI Pro account. Once you get “Interactive authentication successfully completed” message, you’re good to go.</p><pre>group_id=&#39; &#39;<br>report_id=&#39; &#39;</pre><pre>report = Report(group_id=group_id, report_id=report_id, auth=device_auth)</pre><pre>report</pre><p>Here, the group_id is essentially the workspace ID and report_id, the dashboard ID. If you open the dashboard in Power BI web app, copy past the URL into a notepad. It will have the following format: <a href="https://app.powerbi.com/groups/________/reports/__________/">https://app.powerbi.com/groups/________/reports/__________/</a></p><ul><li>Your group_id will be the text between ‘groups/’ and the next ‘/’.</li><li>The report_id will be the text after ‘reports/’ up till the next ‘/’.</li><li>Both of these will be a unique sequence of numbers and letters.</li></ul><p>Once you run ‘report’, you should be able to see the dashboard and interact with it. Isn’t that so cool?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*MDZCpFVdo6u9OAbiHPVUyA.gif" /></figure><h3>Troubleshooting</h3><p>The codes I’ve used are directly from the ones defined in the official article published on <a href="https://powerbi.microsoft.com/en-us/blog/announcing-power-bi-in-jupyter-notebooks/">Microsoft Power BI blog</a> but there were a few errors that I came across.</p><ul><li>I usually use Jupyter Notebook on Safari, but when I ran the cell, although it was successful, I wasn’t able to see my dashboard. To fix this, I switched to Google Chrome and changed a few settings under the Developer Tools tab- disable ‘JavaScript Source Maps’ and ‘CSS Source Maps’, restart your browser and run the cells again.</li><li>Another method of initiating device authentication is by using</li></ul><pre>access_token = device_auth.get_access_token()</pre><p>instead of the one I’ve mentioned above and replacing ‘auth=device_auth’ with access_token = access_token when defining ‘report’.</p><pre>report = Report(group_id=group_id, report_id=report_id,access_token = <br>access_token)</pre><p>You should be good to go with these!</p><p>Hope you were able to follow this simple tutorial on embedding Power BI dashboards into Jupyter Notebook! There are so many other tasks that can be accomplished with this package, that I hope to explore further in the coming days. Feel free to share your insights and findings, I’d love to hear from you!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c9719af869f2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[It’s A-OK to not have an internship as a Data Science aspirant]]></title>
            <link>https://anaghasridhar.medium.com/its-a-ok-to-not-have-an-internship-as-a-data-science-aspirant-9aad775fc3ab?source=rss-14ea94a6b9e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/9aad775fc3ab</guid>
            <category><![CDATA[forage]]></category>
            <category><![CDATA[students]]></category>
            <category><![CDATA[internship-experience]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[omdena]]></category>
            <dc:creator><![CDATA[Anagha]]></dc:creator>
            <pubDate>Wed, 16 Jun 2021 06:00:08 GMT</pubDate>
            <atom:updated>2021-06-17T06:56:48.869Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_PoNZjd1PhSX9o00" /><figcaption>Photo by <a href="https://unsplash.com/@magnetme?utm_source=medium&amp;utm_medium=referral">Magnet.me</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>I don’t know if it’s just me, but do you keep getting notifications on LinkedIn saying <em>“Congratulate John Doe for starting a new position as an Intern at XYZ” ? </em>Now that most universities are on summer break, it’s the time for students to up their skills and do something beyond what’s taught in their respective classes and gain as much domain and industry knowlegde as possible.</p><p>To be honest, I’ve got to admit that getting those notifications sometimes bum me out. It’s not that I’m jealous, but rather feel bad that I haven’t been able to land one despite scouting all over the internet and applying to as many roles as possible. What made it worse was the fact that I’m about to start my senior year and campus placements are right around the corner. Various questions started circling my mind.</p><ul><li>What if I don’t land a job because I don’t have prior work experience? (the endless loop of needing experience to get experience)</li><li>Why have I not been able to land an internship when people with the same knowledge are?</li><li>What am I doing wrong?!</li></ul><p>I ended up feeling really demotivated… until I joined into a room on Clubhouse where senior data scientists and experts were sharing their experience. They kept re-iterating the fact that it’s totally okay to not have an work experience when applying for a job, because in the end, it’s the knowledge that recruiters are looking for. There are so many different ways to show ‘experience’ on your resume that aren’t the usual online courses and internship certificates. This got me thinking.</p><p>Rather than sulking around about not getting an internship, what can I do to use my time productively and effectively?</p><p>Here are 3 ways that I found and plan on following in the coming weeks:</p><h4>1. Projects + Porfolio</h4><p>Every Data Scientist who I’ve ever spoken/listened to have insisted that creating unique projects to showcase your analytical and programming skills are the best way to <em>prove</em> your knowledge.</p><ul><li>Learn. Watch a youtube video on a specific topic (eg. Classification techniques using R) Understand the theory behind <em>why </em>it is needed and <em>how</em> they implement it.</li><li>Practice. Take a dataset off of Kaggle (or scrape it if you’re feeling really adventourous) and implement whatever you’ve learnt. Try not to use the cliché Titanic or Iris dataset for projects, instead go for something that truely interests you-be it a musical dataset or something related to fish.</li><li>Share. Write a blog post explaining your learning and share it with the community, upload your codes onto GitHub.</li><li>Create a portfolio to collectively display all your projects. This is a double edged sword and can essentially act as your resume as well. I know I don’t have one yet, but am working on it.</li></ul><p>Remember: learn, practice, share and repeat!</p><h4>2. Virtual ‘internships’</h4><p><a href="https://www.theforage.com/">Forage</a> is actually something I sumbled upon by chance. It is a platform in which students can experience tasks through virtual programs that replicate real life assignments in Fortune 500 companies. There are over 70 programs in diverse industries that students can select.</p><ul><li>No application required</li><li>No prior experience required</li><li>Self paced, but tasks are designed in a way which can be completed within 5–6 hours</li></ul><p>Isn’t that so cool?!</p><h4>3. Volunteer work</h4><p>Another website that I was introduced to is <a href="https://omdena.com/">Omdena</a>. Omdena is a collaborative platform used by organisations to submit a problem, for which AI experts, Data Scientists and other domain experts work together to solve. The projects usually span for around 2 months, with ~50 collaborators. It’s a great place to work on real time projects that have impact on the world as well as to connect and learn from experts in the field. Kind of like a give and take opportunity.</p><p>Now that I’m back on track and motivated to improve myself, I will be working on these 3 things throughout the summer to break the loop of needing experience to get experience. I hope to document my work and progress through blog posts in the coming weeks, so stay tuned! Until then, I’d love to connect and hear from you on <a href="http://linkedin.com/in/anagha-sridhar">LinkedIn</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9aad775fc3ab" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Analysis of My Spotify Streaming History]]></title>
            <link>https://medium.com/swlh/analysis-of-my-spotify-streaming-history-57a6088c3d3?source=rss-14ea94a6b9e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/57a6088c3d3</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[analysis]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[spotify]]></category>
            <dc:creator><![CDATA[Anagha]]></dc:creator>
            <pubDate>Sun, 09 Aug 2020 13:08:36 GMT</pubDate>
            <atom:updated>2020-08-09T20:25:52.787Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kqNvSHiYySkfHjZs" /><figcaption>Photo by <a href="https://unsplash.com/@nadineshaabana?utm_source=medium&amp;utm_medium=referral">Nadine Shaabana</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>Spotisis</strong> /spo-ti-sis/ <br><em>noun</em> <br>The analysis of one’s Spotify streaming history using Python.</p><p>I was reading through a lot of data science related guides and project ideas when I came across an article in which the author compared his song choices with his friend’s. I wanted to do something similar, so set out to analyse my own streaming history and compare it with what the world listens to.</p><blockquote>Through this, I aim to find out more about my music preferences and how that differs from the world’s genral picks.</blockquote><p>I never really put much thought into my music preference before this project — it was always kind of dependent on my mood, and when someone asked me what type of music I like, I had no answer — because it varied from one hour to another.</p><p>I’ve split this project into 2 sections:</p><p><strong>Part A </strong>is the analysis of my music streaming history.</p><ul><li>Timeline of my streaming history</li><li>Day preference</li><li>Favorite artist</li><li>Favorite songs</li><li>Spirit of the songs</li><li>Diversity</li></ul><p><strong>Part B </strong>is the comparison of the top 50 songs streamed on my list with the top 50 songs streamed in 2019</p><h3>The data</h3><p>Spotify allows every user to request a download of all their streaming history, so Part A is completely dependent on that. They also have an amazing <a href="https://developer.spotify.com/">Developer Platform</a> in which the public can use the data available for their own interest. Along with my personal data, I used the audio features option — which breaks down a song and gives it ‘score’ for a number of different attributes. The attributes are as follows:</p><ul><li><strong>Acousticness</strong> — A confidence measure from 0.0 to 1.0 of whether the track is acoustic. 1.0 represents high confidence the track is acoustic</li><li><strong>Danceability</strong> — A description of how suitable a track is for dancing based on a combination of musical elements including tempo, rhythm stability, beat strength, and overall regularity. A value of 0.0 is least danceable and 1.0 is most danceable.</li><li><strong>Energy</strong> — Energy is a measure from 0.0 to 1.0 and represents a perceptual measure of intensity and activity. Typically, energetic tracks feel fast, loud, and noisy.</li><li><strong>Instrumentalness</strong> — Predicts whether a track contains no vocals. “Ooh” and “aah” sounds are treated as instrumental in this context. The closer the instrumentalness value is to 1.0, the greater likelihood the track contains no vocal content.</li><li><strong>Liveness</strong> — Detects the presence of an audience in the recording.</li><li><strong>Loudness</strong> — The overall loudness of a track in decibels (dB). Loudness is the quality of a sound that is the primary psychological correlate of physical strength (amplitude). Values typical range between -60 and 0 db.</li><li><strong>Speechiness</strong> — Speechiness detects the presence of spoken words in a track.</li><li><strong>Valence</strong> — A measure from 0.0 to 1.0 describing the musical positiveness conveyed by a track.</li><li><strong>Tempo</strong> — The overall estimated tempo of a track in beats per minute (BPM). In musical terminology, tempo is the speed or pace of a given piece and derives directly from the average beat duration</li><li><strong>Mode</strong> — Mode indicates the modality (major or minor) of a track, the type of scale from which its melodic content is derived. Major is represented by 1 and minor is 0.</li><li><strong>Key</strong> — The estimated overall key of the track.</li></ul><p>The dataset was a little messy, so I used Pandas to clean it up according to my need for each section. The entire code can be found on the GitHub link at the end of this article.</p><p>For Part B, I used <a href="https://www.kaggle.com/leonardopena/top50spotify2019">this</a> dataset from Kaggle.</p><p>Before we begin, I just want to say something… Don’t come at me for my music choice!</p><h3>Part A</h3><h4>1. Timeline of my streaming history</h4><p>I know that I spend a lot of time listening to music, but I didn’t know I spent <em>that</em> much time! The data dates back to late June of 2019 and was highly varied.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*Ji96ZML42no6SlH85uBqlA.png" /></figure><p>On February 24th 2020, I spent a gasping 535 minutes (which is almost 9 hours) on spotify — the most in the past year! There’s no definite answer as to why the difference between the highest and lowest value (which was in seconds) is so much, but I did register for Spotify Premium around that time, so maybe that was the reason? Push the promos harder you guys ;)</p><h4>2. Day preference</h4><p><em>Does the day of the week affect how long I spend listening to music?</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*1UpZw0NIab7PLZpEuZ6vsg.png" /></figure><p>I usually listen to music while walking to and back from college, so I would’ve predicted that more time would be spent during the weekdays. Sunday is chillday, so it makes sense that it was when I spent most time listening to music.</p><h4>3. Favorite artists</h4><p><em>Do I have a favorite arist?</em></p><p>According the the data, I actually do. There were two factors I considered: the number of times I played an artist’s song and the total amount of time I spent listening to their songs.</p><p>When looking through the data, I found that some of the songs were played only for a few seconds, so that was reducing the accuracy of the results.</p><p>The graphs below show the top 15 artists under both categories.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*83wH1z5e7EV6okcO12Wzlw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*o6ybn8wRgK3evhU5_1Pi9w.png" /></figure><p>Lauv, Shawn Mendes, One Direction and Justin Bieber maintained the top 4 positions under both graphs, whereas the others were rearranged.</p><h4>4. Which songs were played most?</h4><p><em>Was it by the same 15 artists?</em></p><p>Yes, it was — Lauv took 5 of the 15 spots!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1013/1*jvHNPKeSn4pwRWSyIVMVDQ.png" /></figure><p>I realised that some of the top 15 artists (based on the amount of time spent listening to their songs) were on the list because of one or two songs which were repeated multiple times.</p><p>For example, <em>Memories</em> by Maroon 5 was the most played song (played for a total of 184 minutes). When comared to the total time spent listening to the group (430 minutes), the different was about 246 minutes. In percentage, it means that more than 40% of the time spent listening to Maroon 5 was spent only on <em>Memories.</em></p><p>It’s a good song. Admit it.</p><h4>5. Spirit of the song</h4><p><em>Do I listen to positive songs?</em></p><p>Using the valence attribute from Spotify’s audio analysis features, I tried to find out the general spirit of the top 50 songs I listen to. The valence scale is from 0–1, with one being the most positiveness conveyed in the track.</p><p>For the sake of classification:<br>- low spirit = 0 ≤ valence &lt; 0.5<br>- netural = 0.5≤ valence &lt; 0.6<br>-high spirit = 0.6 ≤ valence ≤ 1</p><p>(I named it as ‘spirit’ because ‘positive’ and ‘negative’ didn’t feel right)</p><p>I was pretty unsure about this one and was utterly surprised by the results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/304/1*qwcsTHteRML6MMGFbcqzMA.png" /></figure><p>So I listen to more of low spirit songs?? That doesn’t make sense!</p><p>When I cross referenced the song names to its valence scale, I realised that this may not have been the most accurate representation. Ed Sheeran’s <em>Photograph</em> had a valence scale of 0.18, for which it was categorised as ‘low spirit’. Although it’s not a super high spirited song, it’s not so low either!</p><h4>6. Diversity of songs</h4><p><em>How do the audio features of the songs compare to one another?</em></p><p>The spirit of the song built up my curiosity to know more about how the songs varied from one another in therms of the audio features, so I compared the top 3 most played songs. I believe that my song choices are highly diverse.</p><p>Those who are familiar with these songs know just how much they vary from one another — they give such different vibes, but I needed the data to prove it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*wEdDCohpQOX_J7xSMMW_yA.png" /></figure><p>There is A LOT of difference — most noticable in the loudness and acousticness attributes.</p><p>The next part is based off of this diversity.</p><h3>Part B</h3><p><em>Is my music too diverse? How does it fare when compared to the global top 50?</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*cwz9-KaJ8HFmKRfVewDd4g.png" /></figure><p>Apart from the mode, everything is different! I prefer less groovy, instrumental based songs which have lower energy levels, while the global hits suggest people lean towards fast paced, energetic songs that they can dance to.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/468/1*krSS5h_dn4FStBn72zJ9YQ.png" /></figure><p>The difference between my music’s average tempo (beats per minute) and the global average is 4 BPM. According to research, songs which have 120 BPM are considered to be fast paced songs. My preference seems to be at a little slower pace, though not by much.</p><h3>Conclusion</h3><p>This project was a blast to do. I thoroughly enjoyed learning more about my music preferences and comparing that to the global hits. Now that I am backed with the data, I can say that my music is highly diversified and that I do have a favourite artist — Lauv (considering the amount of time I’ve spent listening to his songs, it wouldn’t be justified to say otherwise!).</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F16916745&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fblow-akiss-lauv-el-tejano-glitter-flying-gif-16916745&amp;image=https%3A%2F%2Fmedia.tenor.com%2Fimages%2Fb51c286cc97197e5fe3ab23dbe3398bb%2Ftenor.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/a71cbeea4d140183fcc0e55e69271ebc/href">https://medium.com/media/a71cbeea4d140183fcc0e55e69271ebc/href</a></iframe><p>Following this article, I would like to continue by applying some machine learning knowledge to create a recommender system based on my music preferences.</p><p>Feel free to comment and view the entire code on my <a href="https://github.com/anagha-sridhar/Spotify_Analysis">GitHub</a>!</p><p>Big thanks to Vlad Gheorghe for his brilliant explanation (huge savior!)</p><p><a href="https://towardsdatascience.com/get-your-spotify-streaming-history-with-python-d5a208bbcbd3">Get Your Spotify Streaming History With Python</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=57a6088c3d3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/analysis-of-my-spotify-streaming-history-57a6088c3d3">Analysis of My Spotify Streaming History</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data Visualisation of Bollywood: Pt. 2]]></title>
            <link>https://medium.com/data-science/visualisation-of-bollywood-2c973328ddc9?source=rss-14ea94a6b9e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/2c973328ddc9</guid>
            <category><![CDATA[plotly-express]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[visualisation]]></category>
            <category><![CDATA[bollywood]]></category>
            <dc:creator><![CDATA[Anagha]]></dc:creator>
            <pubDate>Wed, 08 Jul 2020 07:07:24 GMT</pubDate>
            <atom:updated>2020-07-08T15:27:12.242Z</atom:updated>
            <content:encoded><![CDATA[<h3>Data Visualisation of Bollywood: Pt 2</h3><h4>Pt. 2 ~ Presenting Data using Plotly Express</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yIJMAK-W7PJmt5UA" /><figcaption>Photo by <a href="https://unsplash.com/@kushagrakevat?utm_source=medium&amp;utm_medium=referral">Kushagra Kevat</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>This article will be a visual representation of the data I collected, as written in my <a href="https://towardsdatascience.com/data-visualisation-of-bollywood-365fd57ff1d3">previous post</a>.</p><p>For this visualisation, I will be using the pandas and plotly express libraries, which are imported into Jupyter Notebook using:</p><pre>import pandas as pd<br>import plotly.express as px</pre><p>Then, using the pd.read_csv function, I read the components of the csv file containing the required data.</p><pre>movies = pd.read_csv(&#39;Bollywood_movies.csv&#39;)</pre><p><em>Note: Once I had saved the data collected from BeautifulSoup into an excel sheet, I did a little bit of cleaning and sorting before exporting it into a csv file.</em></p><p>When called, the table looked like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1005/1*Iu_htj_6_9YwOo9MVzK2sg.png" /></figure><p>Since the data is relatively small (9 columns and 25 entries), it kind of limited the visualisations I could do, of which I explored:</p><ul><li>How many top grossing movies were released each year?</li><li>Were there any directors who had directed more than one top grossing movie?</li><li>Which languages were preferred?</li></ul><h4>1. Comparison of World Wide Gross of Movies</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*a8gVnAo9W3gT_Ioi0r79Vg.png" /></figure><p>As seen in this bar graph, the highest grossing movie in Bollywood is <a href="https://www.google.com/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=&amp;cad=rja&amp;uact=8&amp;ved=2ahUKEwjQxLKX8LzqAhUYWX0KHTH0B5sQFjASegQICRAB&amp;url=https%3A%2F%2Fwww.imdb.com%2Ftitle%2Ftt5074352%2F&amp;usg=AOvVaw0drHy3fAZ1iKSgUOehIcgv">Dangal</a> which earned around ₹2,000 crore (roughly around $311 million), closely followed by <a href="https://www.google.com/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=&amp;cad=rja&amp;uact=8&amp;ved=2ahUKEwj208S08bzqAhXESH0KHceWCNgQFjAKegQIAhAB&amp;url=https%3A%2F%2Fwww.imdb.com%2Ftitle%2Ftt4849438%2F&amp;usg=AOvVaw2lzWv70G_ixCoDMeqE7KEl">Baahubali 2</a>, which was at ₹1,800 crore ( $278 million). Dangal earned 50% more than the 3rd most grossing movie, <a href="https://www.google.com/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=&amp;cad=rja&amp;uact=8&amp;ved=2ahUKEwiCxaWY8rzqAhWRV30KHdowAaQQFjAEegQIARAB&amp;url=https%3A%2F%2Fwww.imdb.com%2Ftitle%2Ftt3863552%2F&amp;usg=AOvVaw1WohkwEoSUcF2EbmiTK_ny">Bajrangi Bhaijaan</a>.</p><p>Though the numbers are huge, this doesn’t come as a surprise as Dangal has a fantastic story line which was inspirational to everyone and anyone who watched it (this comes with no bias what so ever).</p><p>Its release in 2016 was a hit in not only India, but also around the world. I was studying in China during that time, and I remember one of my close friends telling me that she had watched the movie with her mom (who had watched it 3 times within a span of a month)!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F3o6wrqkgV6xeFLCcG4%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fyes-celebration-yay-3o6wrqkgV6xeFLCcG4&amp;image=https%3A%2F%2Fmedia1.giphy.com%2Fmedia%2F3o6wrqkgV6xeFLCcG4%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="184" frameborder="0" scrolling="no"><a href="https://medium.com/media/16f9dd942032b45c763365b0b6fad075/href">https://medium.com/media/16f9dd942032b45c763365b0b6fad075/href</a></iframe><h4>2. Year-Wise Graph</h4><p>There are amazing movies produced every year, but I wanted to determine which year had the most number of top grossing movies.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*q8OmAqjg6hF51vWHWGFL0Q.png" /></figure><p>Analysing the graph, it’s evident that 2018 was THE year! 5 top grossing movies all directed and produced in the same year!</p><h4>3. Which Director had the most number of hits?</h4><p>To do this, I created a graph of the director names against the cumulative gross of all their movies. I adjusted the size of the dots to represent the number of movies they had directed from the list.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*qmVfdc3raS0xvvLRZZJx9w.png" /></figure><p>S.S. Rajamouli, director of the <em>Baahubali</em> series, had two movies in total with the highest overall gross (₹2460 crores/ $379 million). It can be noticed that Nitesh Tiwari directed only one movie, but had the highest gross… Can you guess which movie it is?</p><p>You got it, Dangal.</p><h4>4. The Language Preference</h4><p>Of the 25 movies, the majority were in Hindi, with 3 in Telugu and 1 in Tamil.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*74khPhfd9McbUtMpFBeRfw.png" /></figure><p>Again, this doesn’t come as a surprise because the Hindi Film Industry (Bollywood) is by far the largest, followed by the Tamil Industry (Kollywood) and then Telugu Industry (Tollywood).</p><p>Although movies produced in other regional languages didn’t get the recognition that they may have deserved, these movies have been translated to as many popular Indian languages as possible.</p><p>Maybe the trends will change in the coming years… Let’s see!</p><h4>5. Final Thoughts</h4><p>Now that you’ve read this entire post, why don’t you reward yourself by watching one of the many movies listed?</p><p>You deserve it ;)</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F3ohfFEwvFFyM0awGvS%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fdance-bollywood-james-corden-3ohfFEwvFFyM0awGvS&amp;image=https%3A%2F%2Fmedia2.giphy.com%2Fmedia%2F3ohfFEwvFFyM0awGvS%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="233" frameborder="0" scrolling="no"><a href="https://medium.com/media/75af5531f4972c7ab975eccc3a80fc09/href">https://medium.com/media/75af5531f4972c7ab975eccc3a80fc09/href</a></iframe><p>Check out my <a href="https://github.com/anagha-sridhar/bollywood-analysis">GitHub</a> for all the codes.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2c973328ddc9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/visualisation-of-bollywood-2c973328ddc9">Data Visualisation of Bollywood: Pt. 2</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data Visualisation of Bollywood: Pt. 1]]></title>
            <link>https://medium.com/data-science/data-visualisation-of-bollywood-365fd57ff1d3?source=rss-14ea94a6b9e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/365fd57ff1d3</guid>
            <category><![CDATA[bollywood]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[beautifulsoup]]></category>
            <category><![CDATA[web-scraping]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Anagha]]></dc:creator>
            <pubDate>Tue, 07 Jul 2020 09:56:34 GMT</pubDate>
            <atom:updated>2020-11-18T07:07:05.046Z</atom:updated>
            <content:encoded><![CDATA[<h4>Pt. 1 ~ Web Scraping</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ft0pBHiZ9_a4z08l" /><figcaption>Photo by <a href="https://unsplash.com/@sushioutlaw?utm_source=medium&amp;utm_medium=referral">Brian McGowan</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>If you’ve ever had a chance to talk to an Indian about movies, you must have realised how big of part Bollywood plays in their lives. Speaking on behalf of all my countrymen, we just can’t live without them ~ whether it’s laughing to <em>3 Idiots, </em>or living the ever-green moments of <em>Zindagi Na Milengi Dobara </em>(my personal all time favorite), or dancing along with <em>Shah Rukh Khan </em>to <em>Chammak Challo!</em></p><p>The inspiration for this small project came from my rising love towards Bollywood. Since it’s such a huge industry, I wanted to compare the top grossing movies of all time.</p><p>I’ll be splitting up the project into parts, making it easier to follow. This post will revolve around how to gather data using <strong>BeautifulSoup in Python.</strong></p><h4>1. Introduction to Web Scraping, BeautifulSoup &amp; Requests</h4><h4>Web Scraping</h4><p>Collecting data manually is a tedious and time-staking process, which is when Web Scraping comes into play. It is a technique used to automatically retrieve information from a website with little to none effort.</p><blockquote>It is a form of copying, in which specific data is gathered and copied from the web, typically into a central local <a href="https://en.wikipedia.org/wiki/Database">database</a> or spreadsheet, for later <a href="https://en.wikipedia.org/wiki/Data_retrieval">retrieval</a> or <a href="https://en.wikipedia.org/wiki/Data_analysis">analysis</a>. -<a href="https://en.wikipedia.org/wiki/Web_scraping#cite_note-Boeing2016JPER-1">Wikipedia</a></blockquote><h4>BeautifulSoup</h4><p>BeautifulSoup is a Python library which helps with web scraping. <a href="https://pypi.org/project/beautifulsoup4/">It sits upon an HTML or XML parser, providing Pythonic idioms for iterating, searching, and modifying the parse tree.</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rRHLAipggIos8dJB" /><figcaption>Photo by <a href="https://unsplash.com/@kmuza?utm_source=medium&amp;utm_medium=referral">Carlos Muza</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In order to successfully use BeautifulSoup, one has to understand the basics of HTML code, so that the right information can be collected from the page.</p><p>When a page is opened, for example this <a href="https://en.wikipedia.org/wiki/List_of_highest-grossing_Indian_films">wikipedia page,</a> the HTML code can be accessed by right-clicking on the page and then going to ‘inspect’. To a beginner, the amount of code there is sure to be overwhelming, so to find the specific data quickly, one has to highlight a text within the table, right click on that and go to ‘inspect’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d0obfMUgkyR7kWVrbNzboQ.png" /></figure><p>Each element is given a certain tag and class.</p><ul><li>&lt;table&gt; represents the entire table as can be seen from the screenshot below. It’s given a ‘class’ from which the table can be identified. The individual components of the table come under this tag.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5K7eeru4vopKtmzddR3BiQ.png" /></figure><ul><li>Next is the &lt;thead&gt; tag, which is used to represent the header of the table.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gClpRf_560ZnQeDReNEFjg.png" /></figure><ul><li>&lt;tbody&gt; identifies all the rows of the table.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S2kV_lCH659kL40nce1Jog.png" /></figure><ul><li>&lt;tr&gt; identifies the individual rows.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uO1mSJp8glyuKdOZLuBt7A.png" /></figure><ul><li>&lt;td&gt; represents each individual cell of a row.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RrjURIvTUinLWNX5fQsSsw.png" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FZt5p7rm1dWQCs%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fpost-blue-boys-Zt5p7rm1dWQCs&amp;image=https%3A%2F%2Fmedia3.giphy.com%2Fmedia%2FZt5p7rm1dWQCs%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="290" frameborder="0" scrolling="no"><a href="https://medium.com/media/b26c210fc3075e7d51d3dcbfc7d405d7/href">https://medium.com/media/b26c210fc3075e7d51d3dcbfc7d405d7/href</a></iframe><p>Let’s start scraping!</p><h4>2. Getting Started</h4><p>In order to download a page to perform web scraping, the R<em>equests</em> package must be installed. It allows the user to not only download the contents of the page, but to also send HTTP requests.</p><p>This can be installed using the pip command in Terminal.</p><pre>pip install requests<br>pip install beautifulsoup4</pre><h4>3. Importing Libraries</h4><p>For this part, these are the 4 libraries that are needed to collect data.</p><pre>import pandas as pd<br>import numpy as np<br>import requests<br>from bs4 import BeautifulSoup</pre><ol><li><strong>Pandas: </strong>Is used to convert data into a structured form (tabular).</li><li><strong>Numpy: </strong>A popular library that allows a user to perform array operations easily and quickly.</li><li><strong>BeautifulSoup:</strong> Retreives the HTML structure of the page.</li></ol><h4>4. Starting the Code</h4><pre>website=&#39;<a href="https://en.wikipedia.org/wiki/List_of_highest-grossing_Indian_films&#39;">https://en.wikipedia.org/wiki/List_of_highest-grossing_Indian_films&#39;</a><br>website_url=requests.get(website).text<br>soup=BeautifulSoup(website_url,&#39;html.parser&#39;)</pre><p>The code above defines the website from which the data is being retrieved and calls soup function to download it.</p><pre>s = requests.Session() <br>response = s.get(website, timeout=10) <br>response</pre><p>This code ensures that the download of the page has been complete. You should get the output as &lt;Response [200]&gt;, meaning it is complete.</p><h4>5. Reading the Table</h4><pre>my_table = soup.find(&#39;table&#39;, {&quot;class&quot;:&#39;wikitable sortable&#39;})</pre><p>Soup.find function is used to find a specific element in the page by defining its tag and class. As I said above, the tables in a page have the “table” tag, so if there were only one table in the entire page, there wouldn’t be a need to specify its class. In this case, there are multiple tables of which I only want one. When hovering over the table, it can be seen that the table I want has the class ‘wikitable sortable’, so I specified that.</p><p>When you run the print(my_table) function, you would see that it prints out everything within the tag (from &lt;table&gt; till &lt;/table&gt; in the HTML code), which is incredibly hard to read.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/1*yhdHuScqU8_oG9OzSSMKSg.png" /><figcaption>Incase you are wondering, this is how the result looks like. The picture is just a small snippet of the entire outcome.</figcaption></figure><p>In case you are worried about whether you have retrieved the correct table, this code can be used for confirmation. It prints out the column titles and the number of columns there are.</p><pre>header = [th.text.rstrip() for th in rows[0].find_all(&#39;th&#39;)]<br>print(header)<br>print(&#39;------------&#39;)<br>print(len(header))</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/943/1*UhVCfH5dJj8tRwpwyMfADA.png" /></figure><p>To gather the information in each row, the following code was</p><pre>my_table_data = []<br>for row in rows[1:]:<br>            data = [d.text.rstrip() for d in row.select(&#39;td&#39;)]<br>            my_table_data.append(data)</pre><p>Now that the data is gathered, it’s formed into a data frame using pandas.</p><pre>df = pd.DataFrame(my_table_data)</pre><p>When printed, it should look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/930/1*186uikCmgmCKNRF8g_ts8Q.png" /></figure><p>Yay!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FwON3yIPVnZ8w1B72q4%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fsmosh-yes-celebrate-we-did-it-wON3yIPVnZ8w1B72q4&amp;image=https%3A%2F%2Fmedia2.giphy.com%2Fmedia%2FwON3yIPVnZ8w1B72q4%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="246" frameborder="0" scrolling="no"><a href="https://medium.com/media/b521b97ebf7ddadca6ab69b6dfe4ca32/href">https://medium.com/media/b521b97ebf7ddadca6ab69b6dfe4ca32/href</a></iframe><p>The task isn’t over though… Before we save it, it’s best to rename and clean the data as to our liking.</p><h4>6. Cleaning &amp; Saving</h4><p>I renamed the column names and removed unwanted information using this code.</p><pre>df.rename(columns = {0:&quot;Rank&quot;}, inplace = True)<br>df.rename(columns = {1:&quot;Peak&quot;}, inplace = True)<br>df.rename(columns = {2:&quot;Film&quot;}, inplace = True)<br>df.rename(columns = {3:&quot;Year&quot;}, inplace = True)<br>df.rename(columns = {4:&quot;Director&quot;}, inplace = True)<br>df.rename(columns = {5:&quot;Producer&quot;}, inplace = True)<br>df.rename(columns = {6:&quot;Language&quot;}, inplace = True)<br>df.rename(columns = {7:&quot;Worldwide_Gross_INR&quot;}, inplace = True)<br>df = df.drop(columns=[8])</pre><pre>df.head()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/962/1*1SXX25NFf9tIIgUAw7glcw.png" /></figure><p>Once I was happy with my data, I saved it into an excel file.</p><pre>df.to_excel(&#39;Bollywood_movies1.xlsx&#39;, index=True)</pre><p>Voila! We just created our first data table using web scraping!</p><p>Stay tuned to see my visualisation for this dataset. :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=365fd57ff1d3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/data-visualisation-of-bollywood-365fd57ff1d3">Data Visualisation of Bollywood: Pt. 1</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Lyric Comparison of Two Songs: Basic Python]]></title>
            <link>https://medium.com/swlh/lyric-comparison-of-two-songs-basic-python-22ba046d69f3?source=rss-14ea94a6b9e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/22ba046d69f3</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[comparison]]></category>
            <category><![CDATA[music]]></category>
            <dc:creator><![CDATA[Anagha]]></dc:creator>
            <pubDate>Fri, 03 Jul 2020 07:56:15 GMT</pubDate>
            <atom:updated>2020-07-21T04:18:59.261Z</atom:updated>
            <content:encoded><![CDATA[<h3>How Do Two Songs by the Same Artist Compare? ~ Basic Python</h3><p>Ever since <em>Tones and I</em> released her second single, ‘Dance Monkey’, back in May 2019, the song has been a continuous hit around the world. You’d be lying if you said that you hadn’t moved along to the groove or mouthed the words!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*aGzd2YY3yKpFNoD7" /><figcaption>Photo by <a href="https://unsplash.com/@juantures12?utm_source=medium&amp;utm_medium=referral">Juan Camilo Navia</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>I was first introduced to the song by a friend who kept singing it during class. At first, it felt like he was repeating the same lines over and over again — “dance for me, dance for me, dance for me”, until I listened to the song myself. I noticed that there were a few phrases which were actually repeated. I went on to listen to another hit of hers, ‘Never Seen The Rain’ and found a similar pattern.</p><blockquote>I decided to base this small project on the ideology that artists have a <em>style</em> when it comes to choosing words for their lyrics.</blockquote><p>Using basic python skills, I’m going to analyse <em>Tones and I</em>’s top two hit songs: ‘Dance Monkey’ and ‘Never Seen The Rain’ to see if there are any similarities and how she creates her own music style ~ in terms of repeating words, use of accoustic words (like ‘oh’ and ‘ah’) etc.</p><h4>1. Collecting &amp; Cleaning Data</h4><p>I got the lyrics to both songs from <a href="https://www.metrolyrics.com/">Metro Lyrics</a> and edited them so there were no ‘,’ or extra spaces in between. I also changed words like ‘You’ve’ to ‘You have’ just to maintain the uniformity.</p><p>After this, I uploaded it onto JupyterNotebook as a string and assigned a variable (dm &amp; nstr) to it.</p><pre>#Dance Monkey Lyrics<br>dm = &quot;They say oh my god I see the way you shine Take your hand my...make you do it all again All again&quot;<br>dm = dm.lower()</pre><pre>#Never Seen The Rain Lyrics<br>nstr = &quot;All your life no You could...never felt the rain rain rain&quot;<br>nstr = nstr.lower()</pre><p>The dm.lower() function changes the words to ensure that they are all lowercase. If this is not done, the program differentiates ‘You’ from ‘you’, thinking they are different words.</p><p>When printed, the result will look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1009/1*Y0M98VQabY0mWpnRkbbPCw.png" /></figure><p>Since one of the aims is to find how many total words there are in the lyrics, it can’t be done when all the words are in a single string. In order to seperate them, I used the following code</p><pre>split_dm = dm.split(&#39; &#39;)<br>print(split_dm)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1006/1*48zc5n_Xhy4ahN3n6h_2Aw.png" /></figure><p>The same was done for the Never Seen The Rain lyrics as well.</p><h4>2. Classifying Data</h4><p>Next step was to calculate the total number of words and unique words. To calculate the total number of words, I used the LEN() function on the initial variable:</p><pre>len(split_dm)</pre><p>Which resulted in the total being 453 words. Then, to calculate the number of individual words used to compose the song, I used the SET() function on the split_dm variable.</p><pre>unique_dm = set(split_dm)<br>print(unique_dm)</pre><p>This function made sure to list the words which are used at least once, so the outcome looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1009/1*uCqyvArtjyk3QDYUCnuh6Q.png" /></figure><p>Then, to calculate the number of words in the new list, I used the LEN() function.</p><pre>len(unique_dm)</pre><p>There are 72 unique words in total, which means only these words were used to write this song!</p><h4>3. Most Used Words</h4><p>Of the words which were used, I wanted to identify the top 10 ones (the ones which were repeated most) as well as the ones which were used only once.</p><p>The code used below shows each word and its usage count.</p><pre>word_dm = {}<br>for word in unique_dm:<br>    word_dm[word] = 0</pre><pre>for word in split_dm:<br>    word_dm[word] = word_dm[word] + 1<br>print(word_dm)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1006/1*BGyRP8fUw7zKmBrxwrKLxQ.png" /></figure><p>In order to make it easier to read, I used the following code to bind the word and value together.</p><pre>dm_count = sorted(word_dm.items(),key = lambda t: t[1], reverse =True)<br>print(dm_count)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1005/1*2egQcnPu_Y2JmbndJcAANQ.png" /></figure><p>Then, this code was used to retrieve the top 10 most used words.</p><pre>dm_top_10 = dm_count[0:10]<br>dm_top_10</pre><p>When combined the data looks like this</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*fguVoYWKY1YqZuUV5TDxig.png" /></figure><p>I think it’s safe to say that a unique style of <em>Tones and I</em>, which is definitely audible in all her songs is the use of acoustic words like ‘oh’ and ‘ay’, which are in the top 10 for both her songs.</p><h4>4. Words used only once</h4><p>Using a code similar to the one above, I also found the words which were used only once.</p><pre>dm_least_used = dm_count[49:72]<br>len(dm_least_used)</pre><p>There were just 23. The same functions were done for the other song as well.</p><h4>5. Number of words repeated</h4><p>My next objective was to find out how many words were repeated more than once.</p><pre>len(unique_dm)-len(dm_least_used)</pre><p>49 words were repeated.</p><p>In order to find how many times they were repeated, I used the following code:</p><pre>len(split_dm)-len(dm_least_used)</pre><p>49 words were repeated a total of 430 times! WOW</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*1s7fyfBG4oOMeMw7ohB4Yw.png" /></figure><p>The same process was done for the other song as well.</p><h4>6. Visualising</h4><p>I combined data from both songs to form a table in excel, then read it on the notebook.</p><pre>table = pd.read_csv(&#39;song_values.csv&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*jR7SeTXC-BZNZ_Fvyd1MMg.png" /></figure><p>The most effective way to compare the data was by a bar graph.</p><pre>x = table.Name<br>y1 = table.words_in_song<br>y2 = table.words_in_lyrics<br>y3 = table.Words_used_once<br>y4 = table.Words_used_more_than_once<br>y5 = table.Number_of_times_words_repeated</pre><pre>fig = go.Figure(data=[<br>    go.Bar(name=&#39;Total number of words in song&#39;, x=x, y=y1),<br>    go.Bar(name=&#39;Total Number of Repeated Words&#39;, x=x, y=y5),<br>    go.Bar(name=&#39;Number of words used in Lyric&#39;, x=x, y=y2),<br>    go.Bar(name=&#39;Words used once&#39;, x=x, y=y3),<br>    go.Bar(name=&#39;Words used more than once&#39;, x=x, y=y4)])</pre><pre>#Change the bar mode<br>fig.update_layout(barmode=&#39;group&#39;, title =&quot;Comparison Between The Two Songs&quot;)<br>fig.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*9uD4y6qrUnv93N-vGBOAXA.png" /></figure><p>Looking at the graph and table, we can conclude that</p><ul><li>Both songs have <strong>relatively the same number of words</strong> used in lyrics, words used once and words which were repeated more than once — although Dance monkey had a little more of each.</li><li>Despite that, the <strong>number of times the words were repeated was much higher</strong> in Dance Monkey than in Never Seen The Rain.</li><li>Amongst the words used to compose the lyrics, <strong>less than half of them were used only once</strong>.</li></ul><h4>7. Final Thoughts</h4><p>Upon playing with the data further, I found it really interesting how among the two words in the title, only ‘Dance’ was used frequently: 19 times, ‘Monkey’ on the other hand, was used only once in the entire song!</p><p>It was surprising to discover that the number of individual words used to write the lyrics were only a very small number (around 15% ~ 20%), those of which were repeated around 85% to compose the song!</p><p>On a side note, throughout this whole project, my mind was subconsciously dancing to Dance money xD</p><p>View the entire code along with the updated lyrics on my <a href="https://github.com/anagha-sridhar/song_analysis">github</a> .</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=22ba046d69f3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/lyric-comparison-of-two-songs-basic-python-22ba046d69f3">Lyric Comparison of Two Songs: Basic Python</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Beginner’s Guide to SQL: Disney Princess Edition]]></title>
            <link>https://medium.com/data-science/beginners-guide-to-sql-disney-princess-edition-bf830f75529e?source=rss-14ea94a6b9e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/bf830f75529e</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[disney]]></category>
            <category><![CDATA[database]]></category>
            <dc:creator><![CDATA[Anagha]]></dc:creator>
            <pubDate>Thu, 02 Jul 2020 12:54:53 GMT</pubDate>
            <atom:updated>2020-07-04T03:54:57.243Z</atom:updated>
            <content:encoded><![CDATA[<p>I recently finished a SQL course on Coursera and was looking for project ideas when I came across <a href="https://medium.com/swlh/basic-sql-ranking-best-cities-for-avocado-lovers-f4813e2f012?source=---------7------------------">Amanda’s post</a>. I reached out to her and she suggested me reading Okoh Anita’s post on <a href="https://towardsdatascience.com/basic-sql-decides-my-most-preferred-marvel-character-e393fb044397">Basic SQL</a> from which she was inspired. Undoubtedly, I too was inspired by how she described simple queries using a very fun dataset, making it easy to understand.</p><p>Wanting to try something similar, I let down my hair and started looking through the internet for a Disney Princess dataset in which I could perform some of the queries that I had learn in the course. Sadly, I couldn’t find anything specific to only the princesses, so I decided to create my own dataset using SQLite.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*rCz_FJtZjDb6kncB" /><figcaption>Photo by <a href="https://unsplash.com/@zhenhappy?utm_source=medium&amp;utm_medium=referral">pan xiaozhen</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>1) Collecting Data</h4><p>Using the poll ratings given in <a href="https://www.comingsoon.net/movies/features/1112050-poll-results-who-is-the-best-disney-princess">this website</a>, I gathered the ranking of each Princess along with the movie name, number of votes and percentage of votes. I decided to use only the <strong>Name</strong>, <strong>Popularity</strong> and the <strong>Number of Votes.</strong></p><h4>2) Creating a table</h4><pre>CREATE TABLE &quot;Disney&quot; ( &quot;Name&quot; Varchar(10) NOT NULL UNIQUE,<br>                        &quot;Popularity&quot; Int NOT NULL,<br>                        &quot;Votes&quot; Int NOT NULL,<br>                        PRIMARY KEY(&quot;Name&quot;)<br>);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/327/1*V-R7xu6eSYdRSlEpy7sWtg.png" /></figure><p>Note:</p><ul><li>When creating the schema (which is just the structure of the table), it’s important to define certain ‘rules’ for the attributes (column entries).</li><li>VARCHAR defines that the values are strings (i.e. letters/words) and the number within the brackets set the limit for the total number of characters.</li><li>INT is used to specify that the values are numeric.</li><li>NOT NULL is a clause used to state that the values in the column must not be left empty.</li><li>PRIMARY KEY is a unique attribute which can be used to identify the records. I chose this to be the <strong>Name</strong> of the Princesses because I found that there were no duplicates and it would be the most effective way to identify them.</li></ul><h4>3) Adding additional attributes</h4><p>Next, I wanted to add in a few more columns. I did so using the <strong>ALTER TABLE </strong>function:</p><pre>ALTER TABLE Disney<br>ADD &quot;Kindness&quot; INT NOT NULL,<br>    &quot;Intelligence&quot; INT NOT NULL,<br>    &quot;Courage&quot; INT NOT NULL<br>);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/1*ZkKuzcEgDDQEyDC3UbTecA.png" /></figure><h4>4) Inserting Values</h4><p>The next step was to fill the table using the data collected. The values for Name, Popularity and Votes was taken directly from the website mentioned above, whereas the rest was based upon my opinion (don’t judge please!).</p><p>This process was done using the INSERT</p><pre>INSERT INTO Disney VALUES(&quot;Belle&quot;, 1, 539, 9, 9, 7);<br>INSERT INTO Disney VALUES(&quot;Mulan&quot;, 2, 341, 6, 8, 9);<br>INSERT INTO Disney VALUES(&quot;Rapunzel&quot;, 3, 291, 8, 8, 7);<br>INSERT INTO Disney VALUES(&quot;Ariel&quot;, 4, 281, 8, 4, 7);<br>INSERT INTO Disney VALUES(&quot;Elsa&quot;, 5, 267, 7, 7, 7);<br>INSERT INTO Disney VALUES(&quot;Moana&quot;, 6, 251, 7, 7, 9);<br>INSERT INTO Disney VALUES(&quot;Jasmine&quot;, 7, 243, 8, 6, 8);<br>INSERT INTO Disney VALUES(&quot;Cinderella&quot;,8, 204, 9, 4, 5);<br>INSERT INTO Disney VALUES(&quot;Merida&quot;, 9, 187, 7, 7, 9);<br>INSERT INTO Disney VALUES(&quot;Tiana&quot;, 10, 126, 8, 9, 7);<br>INSERT INTO Disney VALUES(&quot;Anna&quot;, 11, 109, 8, 7, 7);<br>INSERT INTO Disney VALUES(&quot;Snow White&quot;,12, 95, 8, 5, 4);<br>INSERT INTO Disney VALUES(&quot;Aurora&quot;,13, 89, 6, 4, 4);<br>INSERT INTO Disney VALUES(&quot;Pocahontas&quot;,14, 77, 8, 8, 9);<br>INSERT INTO Disney VALUES(&quot;Esmeralda&quot;,15, 43, 9, 6, 7);</pre><h4>5) Viewing the entire table</h4><pre>SELECR *<br>FROM Disney;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/1*mZeL7sSb7Xt9PjHEAE2hWw.png" /></figure><h4>6) Ordering Data</h4><p>Though there are only 15 values and it can all be viewed at the same time, I wanted to practice using the <strong>ORDER BY</strong> function.</p><pre>SELECT * <br>FROM Disney<br>ORDER BY Popularity DESC<br>LIMIT 5;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/381/1*psxVEAyi-HgzHf3Tdv8zsA.png" /></figure><h4>7) Finding out the ‘Total Score’</h4><p>Now for the final step, I wanted to practice on using arithmetic functions, so I decided to calculate the sum of kindness, intelligence and courage for each Princess.</p><pre>SELECT *, SUM(Kindness+Intelligence+Courage) AS &quot;Total&quot;<br>FROM Disney<br>GROUP BY Name<br>ORDER BY Total DESC;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/399/1*ZjYOQZIjsYwRrmdjOCnW1g.png" /></figure><h4>8) Conclusion</h4><p>There was a tie between Belle, the all-time fan favourite, and Pocahontas in terms of total score, although the rest of the Princesses weren’t far behind.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2Fn2cXoawD8e5YQ%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fdisney-beauty-and-the-beast-disney-princess-belle-n2cXoawD8e5YQ&amp;image=https%3A%2F%2Fmedia0.giphy.com%2Fmedia%2Fn2cXoawD8e5YQ%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/a793d739b349cdb5f15e6c681bef57bb/href">https://medium.com/media/a793d739b349cdb5f15e6c681bef57bb/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FyQWkWLGL120so%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fdisney-princess-wave-yQWkWLGL120so&amp;image=https%3A%2F%2Fmedia2.giphy.com%2Fmedia%2FyQWkWLGL120so%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="326" frameborder="0" scrolling="no"><a href="https://medium.com/media/e831cb491f1b2d48f4805eda331bb586/href">https://medium.com/media/e831cb491f1b2d48f4805eda331bb586/href</a></iframe><p>Though it was a small dataset, this project was super fun to get started with ~ I began reminiscing about my childhood as I was scraping the webpages for data while practicing the skills I had learnt during the course.</p><p>I would love to get any feedback!</p><p>Now, if you’d excuse me, I’m gonna go binge watch some classic Disney movies :P</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bf830f75529e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-science/beginners-guide-to-sql-disney-princess-edition-bf830f75529e">Beginner’s Guide to SQL: Disney Princess Edition</a> was originally published in <a href="https://medium.com/data-science">TDS Archive</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How happy are countries during this pandemic?]]></title>
            <link>https://anaghasridhar.medium.com/happiest-countries-38be237590a6?source=rss-14ea94a6b9e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/38be237590a6</guid>
            <category><![CDATA[python-programming]]></category>
            <category><![CDATA[un]]></category>
            <category><![CDATA[happiness-science]]></category>
            <category><![CDATA[world-happiness-report]]></category>
            <category><![CDATA[covid-19-crisis]]></category>
            <dc:creator><![CDATA[Anagha]]></dc:creator>
            <pubDate>Sun, 21 Jun 2020 17:02:40 GMT</pubDate>
            <atom:updated>2020-07-03T09:38:37.326Z</atom:updated>
            <content:encoded><![CDATA[<p>Following my previous post on <a href="https://medium.com/@anaghasridhar/keeping-a-work-life-balance-is-the-key-to-success-d357c43171f9">Key to Happiness</a>, and a visualisation <a href="https://medium.com/@anaghasridhar/visualisation-of-covid19-in-india-4121e64947f8">of COVID19</a>, I decided to link the two and explore more on how entire nations fared when asked about their ‘happiness’ using the <a href="https://worldhappiness.report/ed/2020/">World Happiness Report</a> uploaded on official website.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nGfLocoIqKvUBVR1fmCz5A.png" /><figcaption>Chloropleth World Map of Countries Based on March 2020 Happiness Report</figcaption></figure><p>As can be seen from the map above, North America, Europe, Australia and Northern Asia have relatively high Happiness Scores, whereas Sub-Saharan regions have lower scores.</p><p>One may jump into the conclusion that nations that are prosperous have a higher happiness score. To verify this, I graphed the average happiness score of each region against their GDP as of 2020.</p><p><em>*Note: There are nations for which data is not provided… These are shown to have 0 happiness score.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*A7onlZBpc_G10ght-gZSaQ.png" /></figure><p>It is a little more evident that the statement is in fact true, but to prove it further, I created a linear model plot for the same.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/352/1*9HEr60DLVG_ZMF93qPs5qQ.png" /></figure><p>Though its not a perfect linear graph, the trend is shown to be positive. Higher happiness scores are related to higher GDP per capital.</p><p>This came as a little bit of a surprise as the world economy has been down for the past few months due to COVID19.</p><h4>What other factors come in play?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/522/1*eIM6gkCy065cBF2WlgpI4A.png" /></figure><p>In order to find this out, I plotted a heatmap correlation for the datatset.</p><p>It can be seen that there is a strong correlation between Happiness Score, GDP per Capital and Life Expectancy (all around 0.9)</p><p>I explored each of this further.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lLaohl4ZYUftR0Z4rsFftQ.jpeg" /></figure><p>There were no evident correlation between Trust, Generosity and the Happiness score as both graphs were scattered and had various outliers.</p><p>Whereas, the amount of freedom given to citizens had more direct positive effect.</p><h4>How do this year’s data relate to previous years’?</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*aTP6xE-sa5ng3Ioc4NqS8g.gif" /></figure><p>The countries shown below have the highest average scores for the past 5 years. It can be used to see how their scores range for each of the years.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*_E9FDy2gEg50u0Tc6rg8AA.png" /></figure><p>Finland, Denmark, Norway, Switzerland, Netherlands and Sweden have been dominating the top 10 positions for the past few consecutive years, so is it a surprise that they appear once again?</p><blockquote>“People in Scandinavian countries believe in one another and their governments” Professor Jeffrey D. Sachs, <a href="https://www.nytimes.com/2020/03/20/world/europe/world-happiness-report.html">NY Times</a></blockquote><p>During the current situation, isn’t it time we all adopt their way of living?</p><p>Reference:</p><ul><li><a href="https://worldhappiness.report/ed/2020/">https://worldhappiness.report/ed/2020/</a></li><li><a href="https://www.nytimes.com/2020/03/20/world/europe/world-happiness-report.html">https://www.nytimes.com/2020/03/20/world/europe/world-happiness-report.html</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=38be237590a6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Visualisation of COVID19 in India]]></title>
            <link>https://medium.com/analytics-vidhya/visualisation-of-covid19-in-india-4121e64947f8?source=rss-14ea94a6b9e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/4121e64947f8</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[covid19]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[india]]></category>
            <dc:creator><![CDATA[Anagha]]></dc:creator>
            <pubDate>Fri, 19 Jun 2020 06:31:06 GMT</pubDate>
            <atom:updated>2020-06-23T12:38:05.550Z</atom:updated>
            <content:encoded><![CDATA[<p>During this lockdown, Data Scientists jumped into visualising the COVID19 situation from various datasets uploaded on Kaggle, so I decided to follow the bandwagon. Rather than taking data from around the world, I specified my analysis to India, as I would be able to relate the results to what I see around me.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/809/1*y5OBszlGMz0f9_7njTimxw.png" /></figure><p>Using the <a href="https://www.kaggle.com/sudalairajkumar/covid19-in-india?select=IndividualDetails.csv">COVID-19</a> dataset from Kaggle and plotly, here is my visualisation.</p><p>The dataset contains 7 files, of which I used the following:</p><ul><li>Age Group Details</li><li>COVID-19 in Details</li></ul><p>Apart from that, I used the most recent data uploaded on <a href="https://www.mohfw.gov.in/">Ministry of Health and Family Welfare</a> (23.06.2020) for the State-wise count.</p><pre>ag= pd.read_csv(&#39;AgeGroupDetails.csv&#39;)<br>sw = pd.read_csv(&quot;23.csv&quot;)<br>sw_date = pd.read_csv(&quot;covid_19_india.csv&quot;)</pre><h4>Confirmed, Recovered and Deceased Cases Recorded Over Time</h4><p>The first positive case of the virus in India was recorded on January 30th 2020, almost a month after the news broke out on the spread of the pandemic in China. The patient had a history of travel from Wuhan, which can be noticed in the screenshot below.</p><pre>sw_date = pd.read_csv(&quot;covid_19_india.csv&quot;)<br>sw_date.head()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*Ccc4ct2PljbeFRtpUhOmPQ.png" /></figure><p>Using the same csv file, I dropped the unwanted columns and combined the results for each diagnosed date.</p><pre>sw_date = sw_date.drop(columns = [&#39;Sno&#39;,&#39;Time&#39;,&#39;State/UnionTerritory&#39;,&#39;ConfirmedIndianNational&#39;,&#39;ConfirmedForeignNational&#39;])<br>sw_date[&quot;Date&quot;] = pd.to_datetime(sw_date[&quot;Date&quot;]).dt.strftime(&#39;%d-%m-%y&#39;)<br>sw_date[&quot;Date&quot;] = pd.to_datetime(sw_date[&quot;Date&quot;])<br>sw_date = sw_date.groupby(&#39;Date&#39;, as_index=False).sum()<br>sw_date</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/293/1*-b82MxE4c1QZ5JSL21KxfQ.png" /><figcaption>sw_date</figcaption></figure><p>Then, in order to make a comparative line graph showing the progression of the disease, I used the following code</p><pre>sw_date = sw_date.melt(id_vars=&#39;Date&#39;, <br>                 value_vars=[&#39;Confirmed&#39;, <br>                             &#39;Cured&#39;, <br>                             &#39;Deaths&#39;], <br>                 var_name=&#39;Ratio&#39;, <br>                 value_name=&#39;Value&#39;)</pre><pre>fig = px.line(sw_date, x=&quot;Date&quot;, y=&quot;Value&quot;, color=&#39;Ratio&#39;)<br>fig.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*HRecbGBiIw0F8cF80vcdOQ.png" /><figcaption>Progression of COVID19 in India</figcaption></figure><p>As can be noticed from the graph, the number of confirmed cases increased drastically as of April 2020, which was at the end of Phase I of the nation wide lock down. Following this, certain states pledged to extend the lockdown further as cases were continuing to rise. Despite doing so, it can be noticed that the confirmed-case curve has had an immense steep incline and shows no signs of slowing down.</p><p>The curve for cured patients shows a similar trend.One thing to take into consideration is between May 29th and 30th, there was a steep incline in the number of cured cases — 11,264 records.</p><p>With the increase of confirmed cases, the death rate is shown to increase as well.</p><h4>State Wise Data</h4><pre>sw[&#39;Cured_Percentage&#39;] = (sw[&#39;Cured&#39;]/sw[&#39;TotalConfirmed&#39;])*100<br>sw[&#39;Death_Percentage&#39;] = (sw[&#39;Death&#39;]/sw[&#39;TotalConfirmed&#39;])*100<br>sw[&#39;Active_Percentage&#39;] = (sw[&#39;Active&#39;]/sw[&#39;TotalConfirmed&#39;])*100</pre><pre>sw.head()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*Dj3X3Mf8o6a-yoWOpQPrJQ.png" /></figure><pre>fig = px.treemap(sw, path=[&#39;State&#39;], values=&#39;TotalConfirmed&#39;, height=600, width=1000, title = &#39;State Wise Display Based on Total Number of Positive Cases&#39;)<br>fig.update_layout(<br>    title_x = 0.5,<br>    geo=dict(<br>        showframe = True,<br>        showcoastlines = True,<br>    ))</pre><pre>fig.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*x2MxILAoWCKls7yQbqslyQ.png" /></figure><p>Treemaps are a great way to display data based on the hierarchy of data. The figure has the rectangular boxes arranged in descending order based on the number of positive cases recorded. To get a more clear view of the top 10 states for the same condition, I used a scatter graph.</p><pre>fig = px.scatter(sw1, x=&quot;TotalConfirmed&quot;, y=&quot;Active&quot;, size=&quot;Active&quot;, color=&quot;State&quot;,<br>                 hover_name=&quot;State&quot;, log_x=True, size_max=60, title =&quot;Top 10 States Based on Total Number of Positive Cases Recorded against Currently Active Cases&quot;)<br>fig.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*kXxtaxSjmpgAWHCD1yiS2A.png" /></figure><p>As can be seen, Maharashtra has the highest recorded cases as well as total sample number, followed by Delhi. To get a clearer picture of the relation between number of total confirmed cases, deaths, active cases, I created a bar graph for the same states.</p><pre>x = sw1.State<br>y1 = sw1.TotalConfirmed<br>y2 = sw1.Active<br>y3 = sw1.Death<br>fig = go.Figure(data=[<br>    go.Bar(name=&#39;Total Positive Cases Reported&#39;, x=x, y=y1),<br>    go.Bar(name=&#39;Active&#39;, x=x, y=y2),<br>    go.Bar(name=&#39;Death&#39;, x=x, y=y3)<br>    ])<br>#Change the bar mode<br>fig.update_layout(barmode=&#39;group&#39;, title =&quot;Top 10 States Based on Number of Positive Cases Recorded&quot;)<br>fig.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*ZlsN2RyyiPQRAEag_ZNguw.png" /></figure><p>Though this does provide ample information, I wanted to check the relation between the percentage of active cases against the percentage of deaths recorded.</p><p>To do this, I had to arrange the data based on descending order of percentage of deaths.</p><pre>x = sw2.State<br>y2 = sw2.Active_Percentage<br>y3 = sw2.Death_Percentage<br>fig = go.Figure(data=[<br>    go.Bar(name=&#39;Active&#39;, x=x, y=y2),<br>    go.Bar(name=&#39;Death&#39;, x=x, y=y3)<br>    ])<br>#Change the bar mode<br>fig.update_layout(barmode=&#39;group&#39;, title =&quot;Percentage of Active and Death Cases as of 23/06/2020&quot;)<br>ylable=&#39;Percentage&#39;<br>fig.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*oWmVotJbPGVIYJ3lPMg6Ag.png" /></figure><p>Here, it can be seen that though Maharashtra has a higher number of recorded active cases, the percentage of deaths is more in Gujurat.</p><h4>Age Groups Affected by COVID</h4><pre>ag= pd.read_csv(&#39;AgeGroupDetails.csv&#39;)<br>fig = px.pie(ag, values=&#39;TotalCases&#39;, names=&#39;AgeGroup&#39;, title =&quot;Age Groups Affected by COVID19 in Percentage&quot;)<br>fig.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*ZC9x-h0b7B29ggFzZpU9fw.png" /></figure><p>The data shows that patients diagnosed with the disease were between the ages of 20–39, which contradicts the initial claims that COVID19 is more prone to affect those who are either new born or elderly .</p><h4>Conclusion</h4><p>As suggested by my graphs, the spread of COVID19 in India shows no signs of slowing down. Now that the lockdowns have been lifted, the number of confirmed cases have been increasing exponentially, and so have the death rates, making it vital to take the necessary precautions and follow social distancing.</p><ul><li>* code for the <a href="https://www.igismap.com/download-india-boundary-shapefile-free-states-boundary-assembly-constituencies-village-boundaries/">map</a> shown on top *</li></ul><pre>map = gpd.read_file(&quot;Igismap/Indian_States.shp&quot;)<br>map.rename(columns = {&quot;st_nm&quot;:&quot;State&quot;}, inplace = True)<br>map[&quot;State&quot;] = map[&quot;State&quot;].str.replace(&quot;&amp;&quot;,&quot;and&quot;)<br>map[&quot;State&quot;].replace(&quot;Arunanchal Pradesh&quot;,<br>                              &quot;Arunanchal Pradesh&quot;, inplace = True)<br>map[&quot;State&quot;].replace(&quot;Telangana&quot;, <br>                              &quot;Telangana&quot;, inplace = True)<br>map[&quot;State&quot;].replace(&quot;Andaman and Nicobar Island&quot;, <br>                              &quot;Andaman and Nicobar Island&quot;, <br>                               inplace = True)<br>map_data</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*V9jHmuE2txwM8e_yOJ1imQ.png" /></figure><pre>sw[&quot;State&quot;] = sw_state[&quot;State&quot;].str.replace(&quot;&amp;&quot;,&quot;and&quot;)<br>sw_top = pd.DataFrame({&quot;State&quot; : [&quot;Dadara and Nagar Havelli&quot;],&quot;Pos&quot;:[&quot;0&quot;], &quot;Neg&quot;:[&quot;0&quot;]})<br>sw = pd.concat([sw_top, sw_state]).reset_index(drop = True)<br>sw[&quot;State&quot;].replace(&quot;Dadra and Nagar Haveli and Daman and Diu&quot;, <br>                              &quot;Daman &amp; Diu&quot;, <br>                               inplace = True)<br>sw = sw_state.groupby(&quot;State&quot;, as_index = False).sum()<br>sw.fillna(0, inplace = True)<br>sw.head()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/327/1*p81gWip9XzSMSAhEiVS2QQ.png" /></figure><pre>merged_data = pd.merge(map, sw, <br>                       how = &quot;left&quot;, on = &quot;State&quot;)<br>merged_data.fillna(0, inplace = True)<br>merged_data = merged_data.sort_values(by = [&#39;Pos&#39;],ascending= False)<br>merged_data.head()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/554/1*t4kp5Bpq8MV4czGotMduHA.png" /></figure><pre>fig, ax = plt.subplots(1, figsize=(20, 12))<br>ax.axis(&quot;off&quot;)<br>ax.set_title(&quot;Covid-19 Statewise Data — Percentage of Confirmed Cases&quot;, <br>             fontdict =  {&quot;fontsize&quot;: &quot;25&quot;, &quot;fontweight&quot; : &quot;3&quot;})<br>merged_data.plot(column = &quot;Pos&quot;, cmap=&quot;BuPu&quot;, <br>                 linewidth=0.8, ax=ax, edgecolor=&quot;0.8&quot;, <br>                 legend = True)<br>plt.show()</pre><p>*voila</p><p>This is the first time I’m doing a visualisation for a dataset, so I would really appreciate any feedback :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4121e64947f8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/visualisation-of-covid19-in-india-4121e64947f8">Visualisation of COVID19 in India</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Keeping a Work ~ Life Balance is the Key to Success]]></title>
            <link>https://anaghasridhar.medium.com/keeping-a-work-life-balance-is-the-key-to-success-d357c43171f9?source=rss-14ea94a6b9e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/d357c43171f9</guid>
            <category><![CDATA[happiness]]></category>
            <category><![CDATA[success]]></category>
            <category><![CDATA[psychology]]></category>
            <category><![CDATA[work-life-balance]]></category>
            <dc:creator><![CDATA[Anagha]]></dc:creator>
            <pubDate>Wed, 17 Jun 2020 07:35:11 GMT</pubDate>
            <atom:updated>2020-06-21T09:30:33.890Z</atom:updated>
            <content:encoded><![CDATA[<h3>Keeping a Work ~ Life Balance is the Key to Happiness</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*opLOjzfe2kE92jDQ5KqDeA.jpeg" /><figcaption>Even the sky has a balance of its own.</figcaption></figure><blockquote><em>If you’re happy and you know it, clap your hands…</em></blockquote><p>You read the line above in the tune of the evergreen rhyme, didn’t you?</p><p>The catchy beat and its classy words has the power to make you clap along, whether you’re a child or an adult. Just like that, for a few brief minutes, it makes all your worries disappear — almost like magic.</p><p>As a infant, the only possible barrier towards happiness was probably the lack of attention. Ever found it weird how babies could be bawling their eyes out in their cribs but as soon as you pick them up, there wouldn’t be a single tear in their eye — rather, they would give a toothless grin almost immediately? Babies are pretty cheeky aren’t they? Well, that barrier only continues to grow as one gets older. We get so engrossed in stress, greed, jealousy, insecurities, <em>the need to be perfect (… n</em>eed I go on?), that we forget to enjoy and appreciate the little things in life.</p><p>With the recent COVID19 pandemic outbreak, staying at home has given me a different perspective. Obviously, the first few days were amazing — no college, no exams, no tension. Only Netflix, good food and family… What more could I ask for? It was as if my prayers for an extended weekend at home had come true. But as the days went by, I began experiencing less joy out of these simple things.</p><p>Why was this? Just weeks before, I found the greatest joy in the very same activities.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fopen.spotify.com%2Fembed-podcast%2Fshow%2F4dq0wmiZlk58Eu0NcqgWei&amp;display_name=Spotify&amp;url=https%3A%2F%2Fopen.spotify.com%2Fshow%2F4dq0wmiZlk58Eu0NcqgWei&amp;image=https%3A%2F%2Fi.scdn.co%2Fimage%2F10795140ddef34306b0c87c2d4031a647cc86b93&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=spotify" width="600" height="232" frameborder="0" scrolling="no"><a href="https://medium.com/media/75b799e65171efa13c595b9dae3518eb/href">https://medium.com/media/75b799e65171efa13c595b9dae3518eb/href</a></iframe><p>I began listening to this podcast and researching on the psychology behind happiness and found that —</p><blockquote>‘happiness’ is a term given to the balance of satisfaction from work and leisure.</blockquote><p>I compared this to my activities before and during quarantine.</p><p>When I was away from home, I was super satisfied with my work life — I spent time setting and focusing on my academic goals and managing household chores, but comparatively spent very little time on leisure. Whereas during lockdown, I spent all my time scrolling through Instagram, binging on tv shows and hogging in the kitchen, that I turned a blind eye towards my academic goals.</p><p>Supposedly, this imbalance was what was causing the dramatic capsize in my happiness ship. I needed to do something in order to save myself from drowning, so I began to experiment to see if this was the actual situation for me.</p><p>After weeks of having only leisure time, I spent a few days</p><ul><li>distancing myself from social media and other cliche stress busters.</li><li>signing up for an online course and began to dedicate my time to only doing that.</li></ul><p>As research suggested, I <strong>didn’t</strong> regain my happiness. So after a few days, I made a new plan. This time, I made a time table in which I split up the day to fulfil both needs.</p><blockquote>There was dedicated time to study, to watch movies, to go for a walk with my dog, to visit my grandparents — an equal, non-overwhelming balance between work and leisure.</blockquote><p>Without a doubt, I slowly started to see myself in better moods.</p><ul><li>I would wake up determined to finish the allotted section of the online course and wouldn’t budge till it was completed.</li><li>Being in the moment when going on walks with my dog became a norm.</li><li>I started to appreciate the standstill of the city during this lockdown.</li><li>I began noticing the bluer skies and the rainbow sunsets.</li></ul><blockquote>I noticed a change.</blockquote><p>As I’m writing this, I feel much more positive. My ship has withstood the tsunami, the capsize and is now sailing full speed ahead. I feel light, and if it weren’t for this lockdown, I wouldn’t have been able to find and implement this solution. It took time to understand, but it’s something that will last with me forever.</p><p>If you’re experiencing any of the same emotions as I did, give this a shot.</p><blockquote>Write down two skills you want to learn or improve during the next few weeks — one for achieving your academic goal and one for your leisure time. Work towards achieving both by spreading your time equally and see the change.</blockquote><p>I assure you, you will feel happier. :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d357c43171f9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>