<?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 Sabina L on Medium]]></title>
        <description><![CDATA[Stories by Sabina L on Medium]]></description>
        <link>https://medium.com/@SL_dataworld?source=rss-c37fe872c83b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*DxJFrM4IGN6SyP8s6INk4w.jpeg</url>
            <title>Stories by Sabina L on Medium</title>
            <link>https://medium.com/@SL_dataworld?source=rss-c37fe872c83b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 00:21:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@SL_dataworld/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 Synchronized is Global Economic Growth? GDP Analysis in 5 Chart Types]]></title>
            <link>https://medium.datadriveninvestor.com/how-synchronized-is-global-economic-growth-df320c28bac3?source=rss-c37fe872c83b------2</link>
            <guid isPermaLink="false">https://medium.com/p/df320c28bac3</guid>
            <category><![CDATA[visualization]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[finance]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[investing]]></category>
            <dc:creator><![CDATA[Sabina L]]></dc:creator>
            <pubDate>Fri, 29 Jul 2022 11:12:36 GMT</pubDate>
            <atom:updated>2022-07-30T06:25:17.852Z</atom:updated>
            <content:encoded><![CDATA[<h3>How Synchronized is Global Economic Growth? GDP Analysis in 5 Chart Types: Line, Heatmap, Boxplot, Ridgeline, Stacked Bar</h3><p>Remember how investors were chatting about <a href="https://www.morganstanley.com/ideas/global-growth-in-sync">global economic cycle synchronization in 2017</a>? <strong>Turns out that GDP growth rates across the world have been synchronizing over the last 3 decades.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/957/1*oL1l5lMIsQN85H_i1vKFtA.png" /><figcaption>Figure 1. Data Source: World Bank</figcaption></figure><p>Today we’ll go over:</p><ol><li><strong>Data: 3 GDP datasets from World Bank + recessions + country groups</strong></li><li><strong>Visualizations for world GDP trends: <br></strong>✦ <strong>Line charts with labeled recessions<br></strong>✦ <strong>Heatmap for GDP growth rates<br></strong>✦ <strong>Box plots and ridgeline plots for GDP growth distributions by year<br></strong>✦ <strong>Visuals for other country groupings<br></strong>✦ <strong>Stacked Bar Charts</strong></li><li><strong>Why correlation and clustering are not a great choice for this dataset</strong></li><li><strong>Code to generate all visualizations </strong>(can be applied to any of your preferred GDP datasets).</li></ol><p>Shameless self-promotion: my previous article can be used to map GDP by country using plotly:</p><p><a href="https://medium.com/@SL_dataworld/visualize-inflation-world-data-on-plotly-interactive-map-colorscale-solutions-for-outliers-52143b5593b7">Visualize Inflation World Data on Plotly Interactive Map — Colorscale Solutions for Outliers —…</a></p><h3><strong>1. Data: 3 GDP datasets from Wolrd Bank + recessions</strong></h3><p><strong>Recessions: </strong><a href="https://documents1.worldbank.org/curated/en/185391583249079464/pdf/Global-Recessions.pdf"><strong>World Bank identifies 5 global recessions</strong></a><strong> </strong><a href="https://emojipedia.org/chart-decreasing/">📉</a> <strong>over the last 70+ years: 1975, 1982, 1991, 2009, 2020:</strong></p><p>⚠️ <strong>1975 Arab Oil Embargo’73<br></strong>⚠️ <strong>1982: Oil Shock’79<br></strong>⚠️ <strong>1991: Gulf War<br></strong>⚠️ <strong>2009: Financial Crisis’07–09<br></strong>⚠️ <strong>2020: COVID-19 Pandemic</strong></p><p><a href="https://data.worldbank.org/indicator/NY.GDP.MKTP.KN"><strong>GDP in current USD</strong></a><strong>:</strong> this dataset has the advantage of comparability across different countries since worldwide GDPs are converted using current USD exchange rates (using single-year official exchange rates). The majority of the data for each country is available since 1968. At the same time, using this dataset presents a conversion comparability problem, since we’re living in times of USD strength and illiquid exchange rates for smaller countries. Both will be influencing the growth rates we calculate in USD terms.</p><p><a href="https://data.worldbank.org/indicator/NY.GDP.MKTP.KN"><strong>GDP in constant local currency</strong></a><strong>:</strong> nominal GDP for each country using local currency, not adjusted for inflationary effects. Hence, this dataset will have major outliers of GDP growth for countries with rampant inflation. Hence, outliers of huge GDP growth rates in this dataset are likely indications of an economic downturn instead of growth. The majority of data for each country is available since 1968.</p><p><a href="https://data.worldbank.org/indicator/NY.GDP.MKTP.PP.CD"><strong>GDP, PPP (current international $)</strong></a><strong>: </strong>this GDP dataset has been converted to international $ using Purchasing Power Parity (PPP) factor. It will help us analyze the growth-only component on a basis that is comparable across all of the global economies. This dataset is limited to 1990–2021, which is not very useful given that we want to analyze global growth synchronization across various cycles.</p><p>Additionally, the World Bank groups countries in several ways — which is useful in heatmaps:</p><p>🌍 <strong>7 geographic regions<br></strong>💵 <strong>4 income categories <br></strong>👤 <strong>4 demographic dividend groups (</strong><a href="https://data.worldbank.org/country/V2"><strong>browse here</strong></a><strong>)</strong></p><p>We will use different visualizations on the 3 available GDP datasets. Sometimes we’ll provide the same chart using all 3 datasets to illustrate and discuss the differences between various GDP metrics.</p><h3>2. Visualizations</h3><h3>✧ <strong>Line charts with labeled recessions</strong></h3><p><strong>Global growth rates by region appear to be de-synchronized up until 1990–2000</strong> — take a look at the chart of % growth in GDP (USD) data over 1968–2021 (Figure 1, World Bank,). However, <strong>since 1990s up until 2021 the changes in GDP growth rates are becoming more and more aligned, with peaks and troughs matching nearly perfectly across all global regions</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*oL1l5lMIsQN85H_i1vKFtA.png" /><figcaption>Figure 1. Data Source: World Bank</figcaption></figure><h3>✧ Heatmaps: GDP level &amp; % growth</h3><p>If you want a different look at the same data refer to the heatmap below (Figure 2). <strong>It’s easier to see how the negative (red) values on the heatmap for % GDP change in USD align across the years for each world region. We can see this both in the GDP USD data, and PPP-adjusted GDP by each of the regional groupings. Although note that PPP-adjusted data starts only from 1990.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IjCwQrnlCakPaDocTTKIBw.png" /><figcaption>Figure 2. Data Source: World Bank</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/977/1*MiZc6XQ8JbPHxLm-QIxBaw.png" /><figcaption>Figure 3. Data Source: World Bank</figcaption></figure><p>It appears that we have been enjoying global growth-synchronization for a while now. Again, we need to keep in mind that using GDP data denominated in USD is not perfect. But aggregating GDP by regions is not a sensible task unless everything is translated into one single currency.</p><p>The exchange rates of global currencies vs USD will be influencing the year-over-year change in GDP values. Thus, the seemingly increasing synchronization of global GDP growth rates could be due to USD exchange rate effects. The economic effects of our increasingly globalized world are likely playing a role here too, especially in the past 3 decades when the growth has synchronized most noticeably.</p><h3>✧ <strong>Box plots and ridgeline plots for GDP growth distributions by year</strong></h3><p><strong>Here we look at the distributions of GDP growth rates across all countries each year in two different ways. One issue with this approach is that we’re not accounting for the proportional contribution of economies to the world economic cycle. We also do not account for the closer interactions of some subsets of the world economies with one another.</strong></p><h4>1. ✧ Box Plot - GDP in local currency</h4><p>Here we’ll use GDP figures denominated in <strong>local currency </strong>in each country to consider the inflationary effects. <strong>Hence, we’ll see outliers for economies with rampant inflation. </strong>The change in the shape of the distribution year by year will help us gauge how different the growth rates are for the world economies year-to-year.</p><p>We are not accounting for the contribution of each country to the world economy, so no matter how small the country is, it will still be a part of the distribution of growth rates, hence influencing the shape of the distribution on equal terms with bigger countries.<br>Note in the earlier years (70s) we have missing values for several countries, which also influences the comparability of distributions across the years.</p><p>Since plotly also labels the min, max and median of each distribution automatically, I decided to include this interactive plot below for you to explore. <strong>We can clearly see the change in the shape of the distributions from year-to-year with larger downside outliers during the years of global recessions. In the years in between recessions, the shape of the distributions narrows down indicating synchronization of growth cycles.</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fdatapane.com%2Freports%2FVkBW52A%2Fgdp-growth-distributions-in-local-currency-all-countries-by-year-1968-2021%2Fembed%2F&amp;display_name=Datapane&amp;url=https%3A%2F%2Fdatapane.com%2Freports%2FVkBW52A%2Fgdp-growth-distributions-in-local-currency-all-countries-by-year-1968-2021%2F&amp;image=https%3A%2F%2Fstorage.googleapis.com%2Fdatapane-files-prod%2Fdp%2Fthumbnails%2F63e52b84-5f94-43f2-9489-744fb20cacb2.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=datapane" width="960" height="700" frameborder="0" scrolling="no"><a href="https://medium.com/media/061a9d28dba8b01bba8d33781e448c01/href">https://medium.com/media/061a9d28dba8b01bba8d33781e448c01/href</a></iframe><h4>2. ✧ Ridgeline plot — GDP PPP growth</h4><p>Another way to examine the shapes of the distributions by year is through ridgeline plots. Here we will use the third GDP dataset: % change in GDP PPP, which is only available from 1990 to 2021. We would have performed our entire analysis using this dataset since it reflects economic growth in the most “pure” way and is comparable across countries, yet the history is very limited.</p><p>Notice how wide the distributions of % GDP PPP growth are during the recession years of 2020 and 2009. We also observe a lot of negative outliers from distributions following the 1991 recession. The distributions during other years are highly concentrated around a single mean, increasingly so starting from the late 90s. <strong>Hence, our data tells us that we have been living in the global growth synchronization cycle for nearly 3 decades.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*A1UrrcFX69ArEqTjWfKdxg.png" /><figcaption>Figure 5. Data Source: World Bank</figcaption></figure><h3>✧ <strong>Visuals for other country groupings</strong></h3><p>World Bank also separates countries into <strong>4 income categories and 4 demographic dividend groups</strong> (<a href="https://data.worldbank.org/country/V2">browse here</a>). We can observe the same trends we had previously seen with geographical groupings —<strong> the global growth synchronization is present everywhere</strong>.</p><p>There is one clear laggard, however — low-income countries which are likely the source of outliers in growth distributions we examined year by year.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/961/1*yJnNPFLyh2Ncuf3ePcFaCg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/961/1*VR2nlIHHdiMPcJ3iOlBoNQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GRc10BGHxfHxZIspsjlDeQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yLRXXUsa4jdWW2Zw4ncUXg.png" /><figcaption>Figure 6: Data Source: World Bank</figcaption></figure><h3>✧ <strong>Stacked Bar Charts</strong></h3><p>By the way, for those of you curious about GDP (in USD) for all countries around the world, feel free to examine the following interactive Bar chart. You can use toggles on the legend to select/de-select the regions):</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fdatapane.com%2Freports%2Fv7J2WB7%2Fstacked-bar-chart-world-gdp-by-region-usd%2Fembed%2F&amp;display_name=Datapane&amp;url=https%3A%2F%2Fdatapane.com%2Freports%2Fv7J2WB7%2Fstacked-bar-chart-world-gdp-by-region-usd%2F&amp;image=https%3A%2F%2Fdatapane.com%2Fstatic%2Fpython_report_illustration.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=datapane" width="960" height="700" frameborder="0" scrolling="no"><a href="https://medium.com/media/d9fba165c129cd29c5af103f2d8dff18/href">https://medium.com/media/d9fba165c129cd29c5af103f2d8dff18/href</a></iframe><h3>3. ❓Why correlation and clustering are not a great choice to answer our question given the nature of our data</h3><p>So is there another way to see whether the global cycles are synchronizing?</p><ul><li><strong>Correlation is not the best measure given our purposes and data constraints. </strong>Even if we apply rolling windows — we simply do not have enough data points to make valuable observations with rolling-window correlations on annual data. But if you have more granular data, you can try to apply the rolling window correlations from 19xx-2010Q1, then 19xx-2011Q1, 19xx-2012Q1, and so on. This is used pretty frequently in the industry to gauge whether the correlations are trending up/down.</li><li>We could consider <strong>time-series clustering</strong>, although the primary purpose is to find the most similar time series. Again, it is possible to cluster series in a rolling-widow fashion and see whether the cluster labels shift based on the rolling window selection.</li></ul><h3><strong>4. Code to generate all visualizations</strong></h3><p>Full code for visualizations for geographic grouping:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ef3491f5a81fb287ec57f995019c31e7/href">https://medium.com/media/ef3491f5a81fb287ec57f995019c31e7/href</a></iframe><p>Thank you for reading — would be glad to hear your thoughts and suggestions in the comment section!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hMiFLKtLQSA2LVs1" /><figcaption>Photo by <a href="https://unsplash.com/@prateekkatyal?utm_source=medium&amp;utm_medium=referral">Prateek Katyal</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>References:</strong></p><p><strong>Global recessions defined by World Bank:</strong></p><ul><li><strong>1975 Arab Oil Embargo’73</strong></li><li><strong>1982: Oil Shock’79</strong></li><li><strong>1991: Gulf War</strong></li><li><strong>2009: Financial Crisis’07–09</strong></li><li><strong>2020: COVID-19 Pandemic<br></strong>Note that the names of these recessions are somewhat arbitrary.</li><li><a href="https://documents1.worldbank.org/curated/en/185391583249079464/pdf/Global-Recessions.pdf">https://documents1.worldbank.org/curated/en/185391583249079464/pdf/Global-Recessions.pdf</a></li><li><a href="https://www.worldbank.org/en/news/press-release/2020/06/08/covid-19-to-plunge-global-economy-into-worst-recession-since-world-war-ii#:~:text=%E2%80%9CThe%20COVID%2D19%20recession%20is,Prospects%20Group%20Director%20Ayhan%20Kose">https://www.worldbank.org/en/news/press-release/2020/06/08/covid-19-to-plunge-global-economy-into-worst-recession-since-world-war-ii#:~:text=%E2%80%9CThe%20COVID%2D19%20recession%20is,Prospects%20Group%20Director%20Ayhan%20Kose</a>.</li></ul><p><strong>Other References:</strong></p><ul><li><a href="https://www.morganstanley.com/ideas/global-growth-in-sync">https://www.morganstanley.com/ideas/global-growth-in-sync</a></li><li><a href="https://www.investopedia.com/updates/purchasing-power-parity-ppp/">https://www.investopedia.com/updates/purchasing-power-parity-ppp/</a></li><li><a href="http://economyria.com/nominal-ppp-gdp/">http://economyria.com/nominal-ppp-gdp/</a></li><li><a href="https://medium.com/@SL_dataworld/visualize-inflation-world-data-on-plotly-interactive-map-colorscale-solutions-for-outliers-52143b5593b7">https://medium.com/@SL_dataworld/visualize-inflation-world-data-on-plotly-interactive-map-colorscale-solutions-for-outliers-52143b5593b7</a></li></ul><p>Subscribe to DDIntel <a href="https://ddintel.datadriveninvestor.com/">Here</a>.</p><p>Join our network here: <a href="https://datadriveninvestor.com/collaborate">https://datadriveninvestor.com/collaborate</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=df320c28bac3" width="1" height="1" alt=""><hr><p><a href="https://medium.datadriveninvestor.com/how-synchronized-is-global-economic-growth-df320c28bac3">How Synchronized is Global Economic Growth? GDP Analysis in 5 Chart Types</a> was originally published in <a href="https://medium.datadriveninvestor.com/">DataDrivenInvestor</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[6 Unconvetional Books for Finance Professionals — Personal & Professional Development]]></title>
            <link>https://medium.com/@SL_dataworld/6-unconvetional-books-for-finance-professionals-personal-professional-development-ab37da83499d?source=rss-c37fe872c83b------2</link>
            <guid isPermaLink="false">https://medium.com/p/ab37da83499d</guid>
            <category><![CDATA[investing]]></category>
            <category><![CDATA[book-review]]></category>
            <category><![CDATA[finance]]></category>
            <category><![CDATA[careers]]></category>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[Sabina L]]></dc:creator>
            <pubDate>Sat, 23 Jul 2022 23:31:33 GMT</pubDate>
            <atom:updated>2022-07-24T14:29:23.002Z</atom:updated>
            <content:encoded><![CDATA[<h3>6 Unconvetional Books for Finance Professionals — Personal &amp; Professional Development</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o9MtKmLsIMN0zI3mx18FfQ.jpeg" /></figure><p><strong>The sheer volume of books &amp; book reviews is overwhelming.</strong> It gets harder and harder to figure out which book is worth our time. <strong>Before you read any book you should have at least a basic idea of the value-add for you. </strong>However, reviews on Amazon and Goodreads typically do not address all of our decision criteria.</p><p>Today, I’m sharing some of my <strong>all-time favorite reads and what I’ve learned from them as an investment management professional. This list would be useful for those curious about finance, investing &amp; career development in the business field.</strong></p><p>Many of my colleagues in the financial industry are reading these books. <strong>Thinking and Bets</strong> and <strong>Never Split the Difference</strong> were featured in the firm-wide book club I used to organize together with two other colleagues.</p><p>Note that I will only cover 1–2 takeaways instead of a comprehensive review of each book. I’ll link other great summaries for you to enjoy &amp; save some time.</p><h3>Personal &amp; Professional Development Book List<strong>:</strong></h3><ol><li><strong>Thinking in Bets, <em>Annie Duke</em></strong></li><li><strong>Never Split the Difference, <em>Chris Voss</em></strong></li><li><strong>Range: Why Generalists Triumph in A Specialized World, <em>David Epstein</em></strong></li><li><strong>Calling Bullsh*t, <em>Carl Bergstrom &amp; Jevin West</em></strong></li><li><strong>How to Solve It, <em>George Polya</em></strong></li><li><strong>Geopolitical Alpha, <em>Marko Papic</em></strong></li></ol><p>Next, I’ll share details on why each book applies to finance professionals, including my observations about the traits of the most successful portfolio managers.</p><h3><strong>1. Thinking in Bets, <em>Annie Duke</em></strong></h3><p>✅<strong> Takeaway: Do not confuse the quality of the decision with the quality of the outcome.</strong></p><ul><li>As an investment management professional, I believe that <strong>quality investment decision making processes </strong>are necessary for long-term success. Bad or good luck can affect your short-term performance.This applies both to fundamental and quantitative frameworks. The only way to stay in the investing game for a long time is to evaluate and improve your processes regardless whether you made or lost money. <br><br>While portfolio managers are evaluated based on results, the best way to improve your performance is to focus on the quality of your decision-making processes.<br><br>The hardest part for any analyst is to acknowledge that their best trade was due to luck, rather than the result of the high-quality decision process. No one wants to analyze mistakes when the result has worked out in their favor — but that’s the only way you grow as an investor.</li></ul><h3><strong>2. Never Split the Difference, <em>Chris Voss</em></strong></h3><p>✅<strong> Takeaway: No is a pathway to Yes. “You’re right” is not the same as “that’s right” — the latter indicates that a person actually agrees with your idea.</strong></p><ul><li>You will hear a lot of No-s in your career path. This book helped me realize that hearing a No is almost a precondition to getting a “Yes”. Or even something better — “that’s right”. <br><br>Investment analysts pitch their strategies to portfolio managers and clients. But having a great idea is not enough — you need to communicate it well. Understanding how to improve your pitch after a No and practicing it all the time will benefit your career. <br><br>But beware of hearing “you’re right”, it means you didn’t convince anyone, chances are they just want you to leave and then find an excuse to toss your idea later. You need to hear <strong>“that’s right” </strong>— an indicator that your idea “clicked” with the person.</li></ul><h3><strong>3. Range: Why Generalists Triumph in A Specialized World, <em>David Epstein</em></strong></h3><p>✅<strong> Takeaway: Generalists use their ability to draw parallels across various disciplines through analogical thinking to bring immense value. It pays off to try many career paths and practice “active open-mindedness”.</strong></p><ul><li>In my experience, the most successful portfolio managers I was lucky to work are able to make great calls on sectors &amp; asset classes outside of their primary area of expertise. They often rely on getting the most important information from sector specialists. <br><br>The ability to identify <strong>which information is critical to making a decision</strong> and the ability to <strong>synthesize information</strong> are both distinguishing features of outstanding portfolio managers. Curiosity and the ability to draw parallels between different situations and market regimes are must-haves to professionally manage portfolios. <br><br>Besides that, my personal experience across different asset classes helped me level up my game and think outside of the box to figure out valuable solutions and frameworks.</li></ul><h3><strong>4. Calling Bullsh*t, <em>Carl Bergstrom &amp; Jevin West</em></strong></h3><p>✅<strong> Takeaway</strong>: <a href="https://en.wikipedia.org/wiki/Brandolini%27s_law"><strong>Brandolini’s law</strong></a><strong> states that you need a lot more effort to refute misinformation than to create it. </strong><a href="https://en.wikipedia.org/wiki/Sagan_standard"><strong><em>“Extraordinary claims require extraordinary evidence”</em></strong></a><strong><em>.</em></strong></p><ul><li>Critical thinking skills are a prerequisite for a career in finance. As an investor, you need to rely on information of very high quality to make trades. This book equips you with tools &amp; examples to cut through to the truth and be able to critically evaluate the quality of information someone is trying to sell you.</li></ul><h3><strong>5. How to Solve It, <em>George Polya</em></strong></h3><p>✅ <strong>Takeaway: <em>Understand the problem. Devise a Plan. Carry out the plan. Look back.</em></strong></p><ul><li>This is not just a book on how to teach anyone math skills. <strong>It will teach you the general principles of solving any problem. </strong>The methods in this book apply far beyond math and, in my opinion, should be added to required reading material for every student in any discipline. <br><br>A successful portfolio manager once shared with me this book recommendation. While I was reading it, he further shared with me that majority of the people who asked for his reading recommendation for some reason didn’t end up following it. Don’t make the mistake of missing this material. Moreover, I suggest you re-read at least the summary to refresh your problem-solving skills every year.</li></ul><h3>6. Geopolitical Alpha, Marko Papic</h3><p>✅ <strong>Takeaway: Politicians act based on material constraints regardless of their preferences (even if they got elected based on these preferences). You need to know a lot about the systems to make this assessment and effectively apply the constraints framework.</strong></p><ul><li>This is not a traditional geopolitical book, it is a unique framework that anyone can implement. <br><br>When you are a macro or commodities investor, you typically avoid calling any geopolitical events. The risk is either heightened or not — that’s as far as you go. But geopolitics is critical to global trade, hence being able to identify and follow your own, informed framework to identify risk &amp; opportunities can often make or break your trade. <br><br>Politicians who make their preferences known are often constrained by the reality of their political systems and other factors, which eventually forced them to make a choice based on constraints. Being able to integrate this framework into your investment decision-making process can help you avoid a bad risk, while not missing on good risk — which is the cornerstone principle of investing.</li></ul><h3>Summary of the key points for each book:</h3><ol><li><strong>Thinking in Bets, <em>Annie Duke</em></strong><br>✅<strong> Takeaway:</strong> Do not confuse the quality of the decision with the quality of the outcome.</li><li><strong>Never Split the Difference, <em>Chris Voss </em><br></strong>✅<strong> Takeaway: </strong>No is a pathway to Yes. <em>“You’re right”</em> is not the same as <em>“that’s right”</em> — the latter indicates that a person actually agrees with your idea.</li><li><strong>Range: Why Generalists Triumph in A Specialized World, <em>David Epstein<br></em></strong>✅<strong> Takeaway: </strong>Generalists use their ability to draw parallels across various disciplines through analogical thinking to bring immense value. It pays off to try many career paths and practice “active open-mindedness”.</li><li><strong>Calling Bullsh*t, <em>Carl Bergstrom &amp; Jevin West</em></strong><br>✅<strong> Takeaway</strong>: <a href="https://en.wikipedia.org/wiki/Brandolini%27s_law">Brandolini’s law</a> states that you need a lot more effort to refute misinformation than to create it. <a href="https://en.wikipedia.org/wiki/Sagan_standard"><em>“Extraordinary claims require extraordinary evidence”</em></a><em>.</em></li><li><strong>How to Solve It, <em>George Polya<br></em></strong>✅<strong> Takeaway: </strong><em>Understand the problem. Devise a Plan. Carry out the plan. Look back.</em></li><li><strong>Geopolitical Alpha, <em>Marko Papic</em></strong><br>✅ <strong>Takeaway: </strong>Politicians act based on material constraints regardless of their preferences (even if they got elected based on these preferences). You need to know a lot about the systems to make an assessment and effectively apply the constraints framework.</li></ol><h3><strong>Other Notable Books:</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ARsc3H-1f_G47xjF" /><figcaption>Photo by <a href="https://unsplash.com/@itfeelslikefilm?utm_source=medium&amp;utm_medium=referral">🇸🇮 Janko Ferlič</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>Finance “History”:</strong></p><ul><li><a href="https://www.newyorker.com/recommends/read/billion-dollar-whale-an-absurd-tale-of-financial-fraud"><strong>Billion Dollar Whale</strong></a><strong>, </strong>Tom Wright, Bradley Hope</li><li><a href="https://www.kirkusreviews.com/book-reviews/bradley-hope/blood-and-oil-hope/"><strong>Blood and Oil</strong></a><strong>,</strong> Bradley Hope, Justin Scheck</li><li><a href="https://www.shortform.com/summary/the-big-short-book-summary-michael-lewis"><strong>The Big Short</strong></a><strong>, </strong>Michael Lewis</li></ul><p><strong>General Interest:</strong></p><ul><li><a href="https://www.supersummary.com/spillover/summary/"><strong>Spillover: Animal Infections and the Next Human Pandemic</strong></a><strong>,</strong> David Quammen</li><li><a href="https://yalebooks.yale.edu/book/9780300187793/a-little-history-of-philosophy/#:~:text=This%20engaging%20book%20introduces%20the,in%20the%20history%20of%20philosophy."><strong>A Little History of Philosophy</strong></a><strong>, </strong>Nigel Warburton</li><li><a href="https://www.kirkusreviews.com/book-reviews/wladyslaw-szpilman/the-pianist/"><strong>The Pianist,</strong></a><strong> </strong>Wladyslaw Szpilman</li></ul><p>Note that I am not receiving any kind of compensation or benefit from recommending these books.</p><p>Thank you for reading — would love to hear your thoughts on these books in the comments section!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Kp85x100IQupkL7J" /><figcaption>Photo by <a href="https://unsplash.com/@priscilladupreez?utm_source=medium&amp;utm_medium=referral">Priscilla Du Preez</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>References &amp; links to book summaries:</strong></p><ul><li><strong>Thinking in Bets, <em>Annie Duke</em></strong><br><a href="https://calvinrosser.com/notes/thinking-in-bets-annie-duke/">https://calvinrosser.com/notes/thinking-in-bets-annie-duke/</a></li><li><strong>Never Split the Difference, <em>Chris Voss</em> </strong><a href="https://www.samuelthomasdavies.com/book-summaries/business/never-split-the-difference/">https://www.samuelthomasdavies.com/book-summaries/business/never-split-the-difference/</a></li><li><strong>Range: Why Generalists Triumph in A Specialized World, <em>David Epstein</em></strong><br><a href="https://tylerdevries.com/book-summaries/range/">https://tylerdevries.com/book-summaries/range/</a></li><li><strong>Calling Bullsh*t, <em>Carl Bergstrom &amp; Jevin West</em></strong> <a href="https://www.forbes.com/sites/grrlscientist/2020/08/28/calling-bullsht-by-carl-bergstrom--jevin-west---review/?sh=ad9e64156f68">https://www.forbes.com/sites/grrlscientist/2020/08/28/calling-bullsht-by-carl-bergstrom--jevin-west---review/?sh=ad9e64156f68</a><br><a href="https://www.callingbullshit.org/#:~:text=Calling%20bullshit%20is%20a%20performative,treachery%2C%20trickery%2C%20or%20injustice">Website for the book with more examples</a>.</li><li><strong>How to Solve It, <em>George Polya</em></strong><br><a href="https://math.berkeley.edu/~gmelvin/polya.pdf">https://math.berkeley.edu/~gmelvin/polya.pdf</a></li><li><strong>Geopolitical Alpha, <em>Marko Papic<br></em></strong><a href="https://www.geopoliticalalpha.com/">https://www.geopoliticalalpha.com/</a><br><a href="https://www.cfainstitute.org/en/research/multimedia/2020/geopolitical-alpha-a-framework-for-investors">https://www.cfainstitute.org/en/research/multimedia/2020/geopolitical-alpha-a-framework-for-investors</a></li></ul><p><strong>Other references:</strong></p><ul><li><a href="https://en.wikipedia.org/wiki/Brandolini%27s_law">https://en.wikipedia.org/wiki/Brandolini%27s_law</a></li><li><a href="https://en.wikipedia.org/wiki/Sagan_standard">https://en.wikipedia.org/wiki/Sagan_standard</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab37da83499d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[9 Resume must-dos for finance intern & entry-level jobs — from a former Resume Review Committee…]]></title>
            <link>https://medium.com/@SL_dataworld/9-resume-must-dos-for-finance-intern-entry-level-jobs-from-a-former-resume-review-committee-8e77340b235f?source=rss-c37fe872c83b------2</link>
            <guid isPermaLink="false">https://medium.com/p/8e77340b235f</guid>
            <category><![CDATA[resume]]></category>
            <category><![CDATA[resume-writing]]></category>
            <category><![CDATA[internships]]></category>
            <category><![CDATA[finance]]></category>
            <category><![CDATA[asset-management]]></category>
            <dc:creator><![CDATA[Sabina L]]></dc:creator>
            <pubDate>Fri, 22 Jul 2022 11:32:54 GMT</pubDate>
            <atom:updated>2022-07-22T15:23:55.626Z</atom:updated>
            <content:encoded><![CDATA[<h3>9 Resume must-dos for finance intern &amp; entry-level jobs — from a former Resume Review Committee member</h3><p>Formatting your resume SHOULD take you a long time. <strong>Your attention to detail, ability to communicate, and understanding of the industry standards will all be judged by your resume. </strong>Remember — your goal is to concisely fit important information in a professional one-page document.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lDs_avN0kKstxP7E" /><figcaption>Photo by <a href="https://unsplash.com/@joaoscferrao?utm_source=medium&amp;utm_medium=referral">João Ferrão</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>I was a part of Resume Review Committee at a large asset management firm in NYC for nearly 3 years. It means that I <strong>volunteered</strong> my time to help our firm select resumes for all front-office internships and entry-level jobs in the US. After reviewing more than a thousand resumes, I’d like to share with you <strong>what I wish every intern &amp; entry-level job applicant considered before they submitted their resume for a position in finance</strong>.</p><p>Today I’ll cover:</p><ol><li><strong>Resume must-dos shortlist</strong></li><li><strong>Why does this shortlist work? Dos and Don’ts — examples</strong></li><li><strong>What happens to your resume after you submit an application</strong></li></ol><p>I will follow-up with more tips in other posts.</p><h3><strong>1. Resume must-dos shortlist</strong></h3><p>Before we dive any deeper, here’s the summary of the must-dos for your resume listed roughly in the order of importance. <br>If you apply for an <strong>intern position </strong>— be able to checkmark <strong>at least the first 6</strong> to maximize your chances. <br><strong>For entry-level roles for recent graduates</strong>, you would need all 9 to maximize your chances to get an interview.</p><ul><li><strong>Resume must-dos shortlist:</strong><br>1️⃣ <strong>No longer than 1 page <br></strong><em>Unless you are applying for senior roles — then this guide is not for you<br></em>2️⃣ <strong>Submit as PDF: </strong><em>Resume_Firstname_Lastname.pdf</em><strong><br></strong><em>NEVER submit as a word-doc. Your resume will end up looking like a product of unsuccessful plastic surgery after it passes through automated systems to the reviewers<br></em>3️⃣ <strong>Clean, consistent &amp; logical formatting<br></strong>4️⃣ <strong>No colors, boxes, pictures, photos<br></strong><em>Only plain black &amp; white text, you should not be making a poster<br></em>5️⃣ <strong>Concise bullet points</strong> <strong><br></strong><em>The norm is: 1–2 lines per bullet point, max 3 lines<br></em>6️⃣ <strong>NO TYPOS<br></strong>7️⃣ <strong>Do not repeat yourself<br></strong><em>Find synonyms to describe similar skills &amp; projects </em><strong><br></strong>8️⃣ <strong>Bullet point formula:<br></strong><a href="https://www.themuse.com/advice/185-powerful-verbs-that-will-make-your-resume-awesome"><strong>Action verb</strong></a><strong> + what you did+ job description keyword + result<br></strong><em>E.g.: </em>▪️ <em>Developed equity factor risk model, which was implemented into portfolio management process</em><strong><br></strong>9️⃣ <strong>Clear interest in finance (specific specialty)<br></strong><em>Show your interest in the specific financial role you are applying for. Investment Banking experience alone will not land you a job at an Asset Management firm (and vice versa). Include projects to show your stock picking &amp; portfolio construction skills to get into AM industry.</em></li></ul><p><strong>Other considerations:</strong></p><p>For <strong>US</strong>-based applications, <strong>I highly recommend not adding your photo </strong>to the resume, since you should only be evaluated based on your skills, abilities, and potential, not on how you look.</p><p>While reviewers do not typically select candidates based solely on GPA, students are often required to submit it. <strong>If you don’t have a great GPA, you still have a good shot if you communicate your experience better than others.</strong></p><p>While some of you might want to add a <strong>summary</strong> at the top of your resume, it is not standard practice and is generally not a great idea unless you’re applying for an internship position and your resume has no relevant finance experience.</p><p>Avoid extra large or small fonts, <strong>Times New Roman 9.5–12 </strong>works well.</p><p>Following the above list will not guarantee that you will get an interview. It will <strong>maximize the chances that your resume will be reviewed and thoroughly considered.</strong></p><h3><strong>2. Why does this shortlist work? Dos and Don’ts — examples</strong></h3><p>Resume Review Committee does a lot of heavy-lifting to read through the resumes. There are close to a thousand resumes for each recruiting cycle that need to be reviewed in very short time periods, often under a week. <strong>You need to make it easy for reviewers to evaluate your resume. </strong>Remember, most of us volunteer extra time (unpaid), typically after an intense workday. We want to contribute to our firm’s culture by selecting the best candidates, while also saving some precious time.</p><p>The easier you make for us to identify your skillset, the better. Even if you do not have relevant experience in the finance industry, <strong>knowing the industry resume format alone will get you noticed</strong>. Check out <strong>NYU Stern’s</strong> resume writing guidelines and examples:</p><ul><li><a href="https://web-docs.stern.nyu.edu/admissions/asw-stern-resume-writing-guide-class-of-2019.pdf">https://web-docs.stern.nyu.edu/admissions/asw-stern-resume-writing-guide-class-of-2019.pdf</a></li></ul><p>Here are a few resources to give you an idea of other <strong>great templates used by real candidates who land jobs:</strong></p><ul><li><a href="https://careerservices.upenn.edu/preparing-effective-resumes/undergraduates-student-resume-samples/">https://careerservices.upenn.edu/preparing-effective-resumes/undergraduates-student-resume-samples/</a></li><li><a href="https://resumeworded.com/financial-aid-advisor-resume-example">https://resumeworded.com/financial-aid-advisor-resume-example</a></li></ul><p><strong>Please do not submit anything that looks like a poster to a financial firm:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dzlpYVtYHH_hG1gA" /><figcaption>Photo by <a href="https://unsplash.com/@joannakosinska?utm_source=medium&amp;utm_medium=referral">Joanna Kosinska</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a> — While it’s an appealing photo, not an appropriate color palette for your finance-targeted black &amp; white resume</figcaption></figure><p>About 2–5% of resumes that I have reviewed had <a href="https://www.postermywall.com/index.php/art/template/04c0456857d3225ecc1470e1ce1d2dc5/resume-cv-template-design"><strong>unconventional formatting with colors</strong></a> or looked like <a href="https://webneel.com/26-brilliant-and-colorful-resume-designs-will-make-you-rethink-your-cv"><strong>posters</strong></a>, which took me minutes to decipher. There are A LOT of resume examples online for aspiring financial professionals, so not adhering to basic formatting makes us think you didn’t do your homework. <strong>So most of us will skip your resume if we are bombarded with colors and cannot find relevant information in under 30 seconds. </strong>This will not give you the best chance to land on the shortlist of Resume Review Committee members in a financial firm.</p><p>In fact, <strong>professional recruiters spend about </strong><a href="https://www.hrdive.com/news/eye-tracking-study-shows-recruiters-look-at-resumes-for-7-seconds/541582/#:~:text=In%20its%202018%20Eye%2DTracking,an%20average%20of%207.4%20seconds."><strong>7.4 seconds scanning your resume</strong></a>. Reviewers like me spend a little longer than that. Personally, <strong>I pay a lot of attention to the top section with education, GPA and/or skills, job headers, and the bottom part with skills.</strong></p><p>Some might argue that this is not a perfect (or fair) process. But keep in mind that the single most critical and yet overlooked skill in finance is the <strong>ability to communicate</strong>. If you can’t get your point across, your ideas will not be heard. <strong>Showcase your communication skills with your resume.</strong></p><p><strong>If you do not use colors &amp; graphics in your resume template how do you show your creativity?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VYfZgPar_GwdYs6Q" /><figcaption>Photo by <a href="https://unsplash.com/@carissaweiser?utm_source=medium&amp;utm_medium=referral">Carissa Weiser</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Many reviewers, including myself, <strong>really love your <em>Interests</em> section</strong>, which is typically included at the bottom. Devote one line to list your interests outside of your major &amp; past internships. <br>▪️ <strong><em>Interests</em></strong><em>: painting, stock picking, tennis, fantasy football, poker</em></p><p>We’re looking to select diverse and well-rounded individuals. In my experience, most candidates neglect this important one-liner. When the applicant pool gets as competitive as it has been recently, <strong>concisely highlighting your interest might tip the scales and land you an interview.</strong></p><p>Applicant’s <strong><em>Interests</em></strong> section shows curiosity and time-management ability. The majority of Asset Management (AM) companies these days are also <strong>promoting a healthy work-life balance</strong>. This section is one way to demonstrate that you are interested in maintaining a healthy balance, which is important to you and your future team members.</p><h3><strong>3. What happens to your resume after you submit an application</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UGRUKzTfM4BAq0ALEGbZBw.png" /><figcaption>From personal experience as Resume Review Committee member (and former applicant myself)</figcaption></figure><p>Many large buy-side firms have some version of “Resume Review” Committee — which sits in between HR and Hiring Managers. These committees consist of people who know the kind of skillset required to do the job since they have done it themselves. Hence, committee members like me help select the next generation of analysts to take up our responsibilities as we move up in our own careers. <strong>Resume Review Committee members are not HR, we’re your future colleagues.</strong></p><p><strong>HR narrows down applications from thousands to hundreds.</strong> Resume Review Committee further narrows it down to <strong>a few dozen, if not less</strong>. It means that for the firm I worked for, there will be <strong>4–8 candidates invited to interview for each 1 internship or entry-level role available. </strong>Resume Review Committee sends their top picks to hiring managers who eventually choose the candidates they want to hire.</p><p>If you follow at least the basic resume formatting skills mentioned here and ask your friends to read through your resume for typos &amp; general readability assessment — <strong>you are on the right track.</strong></p><p>As usual, feel free to reach out with comments &amp; questions, and stay tuned for more tips!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QEiey2WKxPD43OT8" /><figcaption>Photo by <a href="https://unsplash.com/@prateekkatyal?utm_source=medium&amp;utm_medium=referral">Prateek Katyal</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>References:</strong></p><p><strong>Action verbs:</strong></p><ul><li><a href="https://www.themuse.com/advice/185-powerful-verbs-that-will-make-your-resume-awesome">https://www.themuse.com/advice/185-powerful-verbs-that-will-make-your-resume-awesome</a></li></ul><p><strong>Check out NYU Stern’s resume writing guidelines and example:</strong></p><ul><li><a href="https://web-docs.stern.nyu.edu/admissions/asw-stern-resume-writing-guide-class-of-2019.pdf">https://web-docs.stern.nyu.edu/admissions/asw-stern-resume-writing-guide-class-of-2019.pdf</a></li></ul><p><strong>Other great resume examples:</strong></p><ul><li><a href="https://careerservices.upenn.edu/preparing-effective-resumes/undergraduates-student-resume-samples/">https://careerservices.upenn.edu/preparing-effective-resumes/undergraduates-student-resume-samples/</a></li><li><a href="https://www.velvetjobs.com/resume/banking-analyst-resume-sample">https://www.velvetjobs.com/resume/banking-analyst-resume-sample</a></li><li><a href="https://resumeworded.com/financial-aid-advisor-resume-example">https://resumeworded.com/financial-aid-advisor-resume-example</a></li></ul><p><strong>Resume templates to avoid when applying for finance internships:</strong></p><ul><li><a href="https://www.postermywall.com/index.php/art/template/04c0456857d3225ecc1470e1ce1d2dc5/resume-cv-template-design">https://www.postermywall.com/index.php/art/template/04c0456857d3225ecc1470e1ce1d2dc5/resume-cv-template-design</a></li><li><a href="https://webneel.com/26-brilliant-and-colorful-resume-designs-will-make-you-rethink-your-cv">https://webneel.com/26-brilliant-and-colorful-resume-designs-will-make-you-rethink-your-cv</a></li></ul><p><strong>Other references:</strong></p><ul><li><a href="https://www.hrdive.com/news/eye-tracking-study-shows-recruiters-look-at-resumes-for-7-seconds/541582/#:~:text=In%20its%202018%20Eye%2DTracking,an%20average%20of%207.4%20seconds">https://www.hrdive.com/news/eye-tracking-study-shows-recruiters-look-at-resumes-for-7-seconds/541582/#:~:text=In%20its%202018%20Eye%2DTracking,an%20average%20of%207.4%20seconds</a>.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8e77340b235f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[When beutifulsoup doesn’t work: selenium for web-scraping  Agriculture data: USDA PSD]]></title>
            <link>https://medium.com/@SL_dataworld/when-beutifulsoup-doesnt-work-selenium-for-web-scraping-agriculture-data-usda-psd-682e2d96a60b?source=rss-c37fe872c83b------2</link>
            <guid isPermaLink="false">https://medium.com/p/682e2d96a60b</guid>
            <category><![CDATA[web-scraping]]></category>
            <category><![CDATA[finance]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[agriculture]]></category>
            <dc:creator><![CDATA[Sabina L]]></dc:creator>
            <pubDate>Thu, 21 Jul 2022 11:16:03 GMT</pubDate>
            <atom:updated>2022-07-21T13:15:30.631Z</atom:updated>
            <content:encoded><![CDATA[<h3>When beutifulsoup doesn’t work: selenium for web-scraping 🌾Agriculture data: USDA PSD</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9_GjNugnPXegUlMc" /><figcaption>Photo by <a href="https://unsplash.com/@tunagraphy?utm_source=medium&amp;utm_medium=referral">meriç tuna</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>When you can’t scrape the website with <strong>beautifulsoup </strong>and/or<strong> </strong><strong>requests </strong>because you need to interact with dropdown-menus or other elements created with Javascript — <strong>selenium package is your next best option. <br></strong>🌾 We will showcase the capabilities of this package<strong> </strong>by<strong> web-scraping</strong> <strong>Agriculture Supply &amp; Demand data</strong> from US Department of Agriculture. This is the data you can use to create your own Supply &amp; Demand models.</p><p><em>Note that websites change their structure, names &amp; locations of elements rather often, which will trigger necessary changes for your scripts to work. This is normal for web-scraping.</em></p><p><strong>In this guide we’ll go over:</strong></p><ol><li><strong>selenium installation and setup<br>i.</strong> Installation &amp; error handling<strong><br>ii. </strong>Open &amp; navigate to pages using chromedriver</li><li><strong>Summary of key package capabilities to get you started<br>i.</strong> How to find and interact with webpage elements<br><strong>ii.</strong> Scrape tables using <strong>selenium</strong> + <strong>pandas</strong></li><li><strong>Scrape historical Agriculture datasets from US Department of Agriculture - full code<br></strong>❗️ <em>For the readers in distant-ish future: you might need to update xpaths or entire code structure if USDA changes their website.</em></li></ol><p>For this demo, I chose<a href="https://apps.fas.usda.gov/psdonline/app/index.html#/app/downloads"> <strong>US Department of Agriculture’s PSD dataset archive </strong></a>which <strong>releases market-moving data on agriculture supply and demand every month</strong>. The <strong>release of this data moves global commodity markets</strong>, which makes it a great dataset for financial data analysts to familiarize themselves with. Scraping this data is a great intro-level example for the practical use of <strong>selenium.</strong><br>Note that PSD stands for <a href="https://www.usda.gov/da/ocp/psd">Procurement Systems Division</a> at USDA.</p><p>❓ <strong>Why not API? </strong>While<a href="https://www.ers.usda.gov/developer/data-apis/"> USDA provides an API</a>, I chose to write a web-scraping script. I am used to the format of the dataset as it is provided and I don’t want to use their API. As of the time of writing, USDA’s API is not the best way to get full historical PSD datasets fast. Also, you will need to register an API token using one of your social media accounts, which is generally prohibited behind <strong>corporate firewalls</strong>.</p><h3><strong>1. Selenium installation and setup</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AgMk11IIn16xyTxf" /><figcaption>Photo by <a href="https://unsplash.com/@jstrippa?utm_source=medium&amp;utm_medium=referral">James Harrison</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Setup is the trickiest part when using this package. While this installation guide has been tested on Mac, I have followed an identical process for Windows in the past. The corporate firewall will make it tricky for some of you.</p><h3><strong>i. Installation &amp; error handling</strong></h3><p>1️⃣ First, open terminal to install the package either via conda or pip:</p><pre>conda install -c conda-forge selenium</pre><pre>pip install selenium</pre><p>2️⃣ Next, figure out your chrome browser version (<a href="https://www.businessinsider.com/what-version-of-google-chrome-do-i-have">here’s how to do that</a>) &amp; <a href="https://chromedriver.chromium.org/downloads"><strong>download the version of the chrome driver</strong></a> that’s compatible with your current Chrome version. Note that you only need to match the version up to <strong>000.0.0000. </strong>Download the driver version that matches your OS specs:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/752/1*65kQKMon0bPcb_1TijqLCg.png" /></figure><p>3️⃣ Next, unzip <strong>chromedriver</strong> into the folder where you want to keep it.</p><p>❗️<strong>For Mac users, </strong>you also need to run extra <a href="https://stackoverflow.com/questions/60362018/macos-catalinav-10-15-3-error-chromedriver-cannot-be-opened-because-the-de">terminal commands</a> so that you don’t have an error when opening the driver. Open the terminal and navigate to the folder where you unzipped your driver. Then run:</p><pre>xattr -d com.apple.quarantine chromedriver</pre><p>❓Note that you can also use drivers for different browsers like <strong>Firefox</strong> or <strong>Internet Explorer.</strong></p><p>❓For those of you trying to follow this guide <strong>behind a company firewall </strong>it is possible that your IT team doesn’t let you download the chromedriver (or the package itself!). However, if you manage to get through to this step and then encounter an error when calling the driver from your code by<strong>webdriver.Chrome()</strong>, you might still be able to run the script if you just press “OK” on whichever error pops up. However, it’s unlikely you’ll be able to schedule your scripts for automatic execution, as you’ll have to click on pop-up error every time you launch the script.</p><h3><strong>ii. Open &amp; navigate to pages using chromedriver</strong></h3><p>Next, initiate an instance of chrome driver by specifying folder where you have unzipped your chromedriver in the step above. Try opening your target page, using <strong>.get() </strong>method and the desired URL address. <br><strong>Sleep for 1 second to let the page load. </strong>I prefer implementing it through <strong>time</strong> package, but you can also do more complex wait times handling with <strong>WebDriverWait</strong> native to selenium.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4893e607aa5ebdad58872ddba68877a8/href">https://medium.com/media/4893e607aa5ebdad58872ddba68877a8/href</a></iframe><pre># ✅ <strong>Frequently used methods for driver object:</strong></pre><pre>driver.get()<br>driver.find_element() <br>driver.close()</pre><pre># ✅ <strong>go back and forth in browsing history</strong><br>driver.forward()<br>driver.back()<br><br>driver.switch_to_window(&quot;windowName&quot;)<br>driver.switch_to_frame(&quot;frameName&quot;)<br>driver.switch_to_default_content()</pre><h3><strong>2. Summary of key package capabilities to get you started</strong></h3><h3><strong>i. How to find and interact with webpage elements</strong></h3><p>After initiating the driver instance and navigating to the desired webpage, we now need to interact with the elements on the webpage.<strong> The general principle is to first locate the element and then interact with it. You will mostly locate elements by XPath or by visible text and then click on them</strong></p><p>Depending on the website you need to scrape you might encounter different elements with which you need to interact. First, you need to open the target website and right click “<strong>Inspect</strong>” option. This will open the panel with HTML elements to the right.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SV4cdq-n88WTVhA2ZzrU4A.png" /></figure><p>There is a line of HTML code in this panel that corresponds to each element on the webpage. Using selenium we can interact with any of these elements. <br><strong>The goal is to sequentially call each element to download the data from the website.</strong></p><p>Here are some of the popular options on how to <strong>find</strong> elements on the webpage using the following methods and the class <strong>By</strong> (which is the feature for the newer versions of <strong>selenium</strong> package, the previous methods are deprecated).</p><pre><strong>from</strong> <strong>selenium.webdriver.common.by</strong> <strong>import</strong> <strong>By</strong></pre><pre>#<strong> </strong>✅ <strong>Ways to locate the element within html code of the webpage:</strong></pre><pre>ID = &quot;id&quot;<br>NAME = &quot;name&quot;<br><strong>XPATH = &quot;xpath&quot;</strong><br>LINK_TEXT = &quot;link text&quot;<br>PARTIAL_LINK_TEXT = &quot;partial link text&quot;<br>TAG_NAME = &quot;tag name&quot;<br>CLASS_NAME = &quot;class name&quot;<br>CSS_SELECTOR = &quot;css selector&quot;<br></pre><pre># ✅<strong> you can also use the following methods (there are more):</strong></pre><pre>.select_by_visible_text()<br>.select_by_value()</pre><p><strong>You will likely locate elements by XPATH most of the time. </strong>To do so, right-click on the elements you want to interact with and choose <strong>Inspect</strong>. This will highlight the HTML code line that corresponds to this element. <br>Next, navigate to the highlighted HTML line and click <strong>Copy-&gt;Copy XPath</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/366/1*lyuG2DyeVyKRFWsBJp5rew.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/857/1*7mjm0E2NQ8SJzEsTwh4Dzg.png" /></figure><p>Next, we use <strong>.find_element()</strong>to locate element by the XPath we have just copied and<strong>.click() </strong>the element to interact with it.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a0a860cc1be2045ba747d15a38758bb2/href">https://medium.com/media/a0a860cc1be2045ba747d15a38758bb2/href</a></iframe><p>There are other ways to interact with the elements on the webpage:</p><pre><strong># </strong>✅ <strong>For elements:<br></strong>element.click()</pre><pre><strong># </strong>✅ <strong>Sending your custom text to the elements of webpage:<br></strong>element.send_keys(&quot;your_text&quot;)<br>element.clear()<br>element.submit() # for elements in forms - locates and clicks submit</pre><p>Also, it’s useful to know that <strong>selenium</strong>package offers more advanced capabilities for interacting with the webpage and its elements, which is not necessary to complete our example today. Feel free to check out more advanced capabilities in the <a href="https://selenium-python.readthedocs.io/index.html">documentation</a> like setting up selenium server and other wonderful things. Or just use the old google recipe <strong><em>“python selenium how to xxxx”.</em></strong><br>To learn more about HTML code structure &amp; objects, check out this article:</p><p><a href="https://betterprogramming.pub/understanding-html-basics-for-web-scraping-ae351ee0b3f9">Understanding the HTML Basics for Web Scraping</a></p><h3><strong>ii. Scrape tables using </strong><strong>selenium + </strong><strong>pandas</strong></h3><p>It is also possible to <strong>scrape tables </strong>with a couple of lines of code with <strong>selenium</strong> + <strong>pandas</strong> packages. When we navigate to the target page using <strong>selenium</strong>, just read all HTML tables with <strong>pandas</strong>. <br>Here’s an example of scraping PSD release schedule using this method and “click” download method:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/62d00251341444373d71878679b3a666/href">https://medium.com/media/62d00251341444373d71878679b3a666/href</a></iframe><h3><strong>3. Scrape historical </strong>🌱 <strong>Agriculture datasets from USDA — full code</strong></h3><p>The monthly Agriculture balance sheet datasets from USDA’s PSD website can be scraped with this script. You can find <a href="https://www.nass.usda.gov/Education_and_Outreach/Understanding_Statistics/pub1554.pdf">detailed data description here</a>.</p><p>Since every month PSD datasets have the same name for the download file we will loop through dropdown menu by year and month using <strong>select_by_visible_text()</strong>method. Then we will locate the required file by using XPath and the text label it contains: “psd_alldata_csv.zip”.<br>For this, we will use:</p><pre>driver.find_element(By.XPATH,&quot;// a[<strong>contains(text(),&#39;{}&#39;)</strong>]&quot;.format(&quot;psd_alldata_csv.zip&quot;)).click()</pre><p>When we click download, we will wait for the file to load, and then we will rename it. It is important to label each file with Month &amp; Year, because the contents of the file do not have this information. Hence we wait for the file to be renamed until starting the next download.</p><p>Additionally, we will have an error log, which you can check either by year in <strong>yr_errs</strong> or <strong>yr_mo_errs</strong> lists.</p><p>❗️ <em>For the readers in distant-ish future: you might need to update xpaths or entire code structure if USDA changes their website.</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/62c4edc4f835f953ed9bb5dd9e533f08/href">https://medium.com/media/62c4edc4f835f953ed9bb5dd9e533f08/href</a></iframe><p>🌱 With these zipped files you can do data analysis for various metrics by each commodity &amp; country. Furthermore, you can construct your own Supply &amp; Demand balance sheet model as in the examples below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0gtndPl1tRIBWZexpNSzPQ.png" /><figcaption><a href="https://www.usda.gov/oce/commodity/wasde/wasde0722.pdf">https://www.usda.gov/oce/commodity/wasde/wasde0722.pdf</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1015/1*vWFODnWSN1rQwq1wCLfluQ.png" /><figcaption><a href="https://www.usda.gov/oce/commodity/wasde/wasde0722.pdf">https://www.usda.gov/oce/commodity/wasde/wasde0722.pdf</a></figcaption></figure><p>Hope this guide helps you get started with your<strong>selenium</strong> webscraping skills. Thanks for reading! Feel free to comment with questions or suggestions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SLZF1oMJTliJwnHA" /><figcaption>Photo by <a href="https://unsplash.com/@prateekkatyal?utm_source=medium&amp;utm_medium=referral">Prateek Katyal</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>References:</strong></p><p>Data:</p><ul><li><a href="https://apps.fas.usda.gov/psdonline/app/index.html#/app/downloads">https://apps.fas.usda.gov/psdonline/app/index.html#/app/downloads</a></li><li><a href="https://www.ers.usda.gov/developer/data-apis/">https://www.ers.usda.gov/developer/data-apis/</a> (only referenced, not used)</li><li><a href="https://www.nass.usda.gov/Education_and_Outreach/Understanding_Statistics/pub1554.pdf">https://www.nass.usda.gov/Education_and_Outreach/Understanding_Statistics/pub1554.pdf</a></li></ul><p>Code:</p><ul><li><a href="https://pypi.org/project/selenium/">https://pypi.org/project/selenium/</a></li><li><a href="https://www.businessinsider.com/what-version-of-google-chrome-do-i-have">https://www.businessinsider.com/what-version-of-google-chrome-do-i-have</a></li><li><a href="https://chromedriver.chromium.org/downloads">https://chromedriver.chromium.org/downloads</a></li><li><a href="https://stackoverflow.com/questions/60362018/macos-catalinav-10-15-3-error-chromedriver-cannot-be-opened-because-the-de">https://stackoverflow.com/questions/60362018/macos-catalinav-10-15-3-error-chromedriver-cannot-be-opened-because-the-de</a></li><li><a href="https://selenium-python.readthedocs.io/">https://selenium-python.readthedocs.io/</a></li></ul><p>More useful HTML materials:</p><p><a href="https://betterprogramming.pub/understanding-html-basics-for-web-scraping-ae351ee0b3f9">Understanding the HTML Basics for Web Scraping</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=682e2d96a60b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Visualize Inflation World Data on Plotly Interactive Map — Colorscale Solutions for Outliers —…]]></title>
            <link>https://medium.com/@SL_dataworld/visualize-inflation-world-data-on-plotly-interactive-map-colorscale-solutions-for-outliers-52143b5593b7?source=rss-c37fe872c83b------2</link>
            <guid isPermaLink="false">https://medium.com/p/52143b5593b7</guid>
            <category><![CDATA[visualization]]></category>
            <category><![CDATA[inflation]]></category>
            <category><![CDATA[towards-data-science]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Sabina L]]></dc:creator>
            <pubDate>Sun, 17 Jul 2022 00:57:19 GMT</pubDate>
            <atom:updated>2022-07-24T02:11:31.534Z</atom:updated>
            <content:encoded><![CDATA[<h3>Visualize Inflation World Data on Plotly Interactive Map — Colorscale Solutions for Outliers — Beginner-Friendly Guide</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/965/1*nN9HDy0ZFHcBoYVg74VtWQ.png" /></figure><p>If you want to make an interactive plot of country-level data — you are in the right place. While we can create a plot for a single snapshot in time, we can also add a scroller and show annual progress of the data. Feel free to press play button and toggle data bins on the right and visualize annual inflation changes world-wide — this is the plot we’ll make by the end of this tutorial.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fdatapane.com%2Freports%2FdA9a2MA%2Fc-inflation-rate-by-year-binned-source-world-bank%2Fembed%2F&amp;display_name=Datapane&amp;url=https%3A%2F%2Fdatapane.com%2Freports%2FdA9a2MA%2Fc-inflation-rate-by-year-binned-source-world-bank%2F&amp;image=https%3A%2F%2Fstorage.googleapis.com%2Fdatapane-files-prod%2Fdp%2Fthumbnails%2F5ca94fe0-6333-471c-b27a-1077ce2dd3dd.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=datapane" width="960" height="700" frameborder="0" scrolling="no"><a href="https://medium.com/media/72972c2eb6f105c5c9bed85f9ecebd2a/href">https://medium.com/media/72972c2eb6f105c5c9bed85f9ecebd2a/href</a></iframe><p>Anyone with basic python skills can follow along — it’s a beginner-friendly guide with some bonus material in the end.</p><p>In this guide we will use two data sources and will cover <strong>5 sections</strong>:</p><ol><li><strong>Plotly installation and other required packages</strong></li><li><strong>Get &amp; preprocess data: two example datasets</strong></li><li><strong>Example 1: Point-in-time snapshot Choropleth (map) plot</strong></li><li><strong>Example 2: Interactive map by year — 3 versions</strong></li><li><strong>Bonus: save, export, publish your plots</strong></li></ol><p>For beginners, package installation could be the biggest hurdle, hence we devote some time to this in this guide.</p><h3><strong>1. Plotly installation and other required packages</strong></h3><p>Open the terminal window. Next, if you are using Anaconda (or any version of it) for environment management run the first line in the text box below. Otherwise, run the pip installation via the second line.</p><pre>conda install -c plotly plotly=5.9.0</pre><pre>pip install plotly==5.9.0</pre><p>Installation and package documentation reference for <a href="https://plotly.com/python/getting-started/">plotly is linked here</a>.</p><p>Additionally, we will be using <strong>pandas </strong>and <strong>numpy</strong>. For the bonus part, we will use <strong>datapane </strong>package<strong>. </strong>You can set this package up, link it to your GitHub and use it to share plots on Medium using this straightforward guide.</p><p>❗️<strong>You should be running this package from jupyter notebooks to avoid issues with displaying your plotly interactive charts.</strong></p><p>Package imports:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/089d73375e723d58ec1000b6a4d13988/href">https://medium.com/media/089d73375e723d58ec1000b6a4d13988/href</a></iframe><h3>2. <strong>Get &amp; preprocess data: two example datasets</strong></h3><p>For both examples, we have countries properly labeled by their full names. Hence, we do not need to relabel anything. But we need to properly read-in data and add some extra code that will allow us to create choropleth charts with ease.</p><p>For our <strong>first example</strong>, we want to see all the latest inflation prints worldwide indexed by full country name. This can be found in <a href="https://tradingeconomics.com/country-list/inflation-rate?continent=world">Trading Economics</a>. You can simply copy the data into your excel file if you do not have a subscription.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/67b1f247fac3f1ba7b9e0a920887c652/href">https://medium.com/media/67b1f247fac3f1ba7b9e0a920887c652/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/490/1*qY-rgkUUTlYU2VKKzoF1nw.png" /></figure><p>For the <strong>second example</strong>, we want to see how inflation changed year-to-year around the world. Hence, we will use the annual inflation data published by <a href="https://data.worldbank.org/indicator/FP.CPI.TOTL.ZG">World Bank</a>, which is currently available for most countries up to 2021. Note that you should download and unzip a csv file.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6972ecf9f22a2cac27f88a9c172b995c/href">https://medium.com/media/6972ecf9f22a2cac27f88a9c172b995c/href</a></iframe><p>Your data frame should have the following structure:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/534/1*dIFKcPY16ICZly9NDaAPIw.png" /></figure><h3>3. <strong>Example 1: Point-in-time snapshot Choropleth (map) plot</strong></h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fdatapane.com%2Freports%2FvAq19XA%2Finflation-rate-world-as-of-1h-2022-source-trading-economics%2Fembed%2F&amp;display_name=Datapane&amp;url=https%3A%2F%2Fdatapane.com%2Freports%2FvAq19XA%2Finflation-rate-world-as-of-1h-2022-source-trading-economics%2F&amp;image=https%3A%2F%2Fdatapane.com%2Fstatic%2Fpython_report_illustration.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=datapane" width="960" height="700" frameborder="0" scrolling="no"><a href="https://medium.com/media/5a1b21fa8a291221686dbfe3df2583ff/href">https://medium.com/media/5a1b21fa8a291221686dbfe3df2583ff/href</a></iframe><p>Here is the code that created our first example. Note that we want to plot the ‘<em>Last’ </em>column of data frame, hence we assign it to <strong>z</strong>parameter. We also use <strong>locationmode </strong>= ‘<em>country names</em>’, but if your data comes in different formats, there are a few more default options available.</p><p>Colorscales can be customized through <strong>colorscale </strong>parameter — <a href="https://plotly.com/python/builtin-colorscales/"><strong>available colorscales here</strong></a><strong>.</strong></p><p>We can also include additional text that will hover over the countries using <strong>text </strong>and feeding selected columns into this parameter. Note that country names specified in <strong>locations </strong>will be displayed by default.</p><p>If you wish to display world map using another projection, check out the <a href="https://plotly.com/python/reference/layout/geo/">available projections here</a> and change ‘equirectangular’ to the one you want inside the <strong>projection </strong>within the geo dictionary in the last code snippet.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/80ad0a5949172c10117407f73368202d/href">https://medium.com/media/80ad0a5949172c10117407f73368202d/href</a></iframe><h3>4. <strong>Example 2: Interactive map by year</strong></h3><p>This is more challenging than the first example, especially if your data contains <strong>outliers </strong>like the inflation dataset does. As discussed, we will use <a href="https://data.worldbank.org/indicator/FP.CPI.TOTL.ZG">World Bank inflation dataset</a> here to get data year by year. We will create <strong>3 versions </strong>of this plot to address certain data issues that we could encounter:</p><p><strong>a) Basic inflation interactive annual chart without special treatment of outliers</strong></p><p><strong>b) Use choropleth on log-transformed inflation (addressing outliers)</strong></p><p><strong>c) Use custom bins (addressing outliers)</strong></p><p>Let’s start with:</p><p><strong>a) Basic inflation interactive annual chart without special treatment of outliers</strong></p><p>First, if your data doesn’t have extreme outliers, it’s easy to generate the choropleth chart animated by year.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fdatapane.com%2Freports%2FwAw6P5k%2Fa-basic-plot-inflation-rate-by-year-source-world-bank%2Fembed%2F&amp;display_name=Datapane&amp;url=https%3A%2F%2Fdatapane.com%2Freports%2FwAw6P5k%2Fa-basic-plot-inflation-rate-by-year-source-world-bank%2F&amp;image=https%3A%2F%2Fstorage.googleapis.com%2Fdatapane-files-prod%2Fdp%2Fthumbnails%2F1fa1f5d2-0a04-4abc-b262-bc6ca787faaf.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=datapane" width="960" height="700" frameborder="0" scrolling="no"><a href="https://medium.com/media/3e5521d718df3c8743e3b314fe67e581/href">https://medium.com/media/3e5521d718df3c8743e3b314fe67e581/href</a></iframe><p>The most important trick in the code below is to set custom <strong>range_color </strong>so that we capture the min and max of the observations <strong>across the entire time. </strong>This way, the colorscale will stay the same regardless of the range of data values from year-to-year, which makes it comparable across time.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/953c07cffdf25df3d8e5d402434ebcdc/href">https://medium.com/media/953c07cffdf25df3d8e5d402434ebcdc/href</a></iframe><p>The problem with applying a standard colorscale on the data that includes several <strong>extreme outliers</strong>, is that we can’t see much difference in colors between the small values. In our case, inflation dataset is comprised of comparatively small values, below 50%, and a few 500%+ extremes, which stretched our color scale too much. While we can try to find a different colorscale (like magma), it doesn’t actually solve the problem for our dataset.</p><p><strong>b) Use choropleth on log-transformed inflation (addressing outliers)</strong></p><p>One way to solve this issue is to transform the variable, for example using log-transform. Let’s compare the histograms of inflation observations with and without log-transform. It’s hard to see the extremes in red, but they are present in the original inflation data, which also has a massive concentration around 0 values.</p><p>The log-transformed data doesn’t have such a problem — the distribution of values is much closer to normal and is not overly concentrated around a few datapoints. Hence, when applying a continuous colorscale to the log-transformed inflation, we will be able to see the color differences much better than using the original inflation data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/901/1*IjsEqdImPpLKuh-qbJkSvg.png" /></figure><p>Hence, using log-transformed inflation will be helpful to make a more readable map, which we did here:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fdatapane.com%2Freports%2F8AV6G8A%2Fb-log-inflation-rate-by-year-source-world-bank%2Fembed%2F&amp;display_name=Datapane&amp;url=https%3A%2F%2Fdatapane.com%2Freports%2F8AV6G8A%2Fb-log-inflation-rate-by-year-source-world-bank%2F&amp;image=https%3A%2F%2Fdatapane.com%2Fstatic%2Fpython_report_illustration.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=datapane" width="960" height="700" frameborder="0" scrolling="no"><a href="https://medium.com/media/ab6feebfc00a719589ddcf05b193aa8c/href">https://medium.com/media/ab6feebfc00a719589ddcf05b193aa8c/href</a></iframe><p>Here, the important part is to add the original non-transformed inflation rate to the hover data using <strong>hover_data </strong>parameter and setting <strong>color </strong>to the ‘<em>Log In</em>fl<em>ation Rate %’ </em>column name.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7ef79cf8b4da9de55101ac55caefbdc1/href">https://medium.com/media/7ef79cf8b4da9de55101ac55caefbdc1/href</a></iframe><p><strong>c) Use custom bins (addressing outliers)</strong></p><p>Another way to address outliers is to group observations into several bins based on range and assign a discrete colorscale. Note that you can de-select the bins you do not wish to examine on the map by toggling the respective bins on the legend. This way you can track the progress of inflation only in the bins of your choice. We have clearly upped the contrast in our chart, making it easier to see the differences across the globe.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fdatapane.com%2Freports%2FdA9a2MA%2Fc-inflation-rate-by-year-binned-source-world-bank%2Fembed%2F&amp;display_name=Datapane&amp;url=https%3A%2F%2Fdatapane.com%2Freports%2FdA9a2MA%2Fc-inflation-rate-by-year-binned-source-world-bank%2F&amp;image=https%3A%2F%2Fstorage.googleapis.com%2Fdatapane-files-prod%2Fdp%2Fthumbnails%2F5ca94fe0-6333-471c-b27a-1077ce2dd3dd.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=datapane" width="960" height="700" frameborder="0" scrolling="no"><a href="https://medium.com/media/72972c2eb6f105c5c9bed85f9ecebd2a/href">https://medium.com/media/72972c2eb6f105c5c9bed85f9ecebd2a/href</a></iframe><p>We’d need to work a bit harder on this one. First, we create custom bin endpoints. Next, assign these bins to each row of dataframe. Next create a separate category with the bin order — it is important as we <strong>need to pass a sorted dataframe to avoid issues with the order of the legend pinpoints</strong>.</p><p>We also create a discrete color scheme or RGB colors with white color assigned to nan values which we need to pass to <strong>color_discrete_map.</strong></p><p>Other notable parameters include <strong>animation_group </strong>which needs to get <em>‘bins’ </em>column converted to string type. You can also update the title of the legend using <strong>update_layout </strong>method shown below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fabbfc1826b9c92f44c03d440b8a61b4/href">https://medium.com/media/fabbfc1826b9c92f44c03d440b8a61b4/href</a></iframe><h3><strong>5. Bonus: save, export, publish your plots</strong></h3><p>You can download your plot as a static image with formats like png, pdf, jpeg, etc. To avoid low-resolution image, we can specify the height and width.</p><p>To keep the option to interact with the plot, you can download it as HTML. See plotly export guide for more options.</p><p>Finally, if you wish to publish your plot to medium or other platfrom, I highly recommend looking into setting up datapane account and link it to your github. It will take you less than 10 minutes if you follow the instructions from <a href="https://towardsdatascience.com/how-to-embed-interactive-charts-on-your-medium-articles-and-website-6987f7b28472">this article</a>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/109504e2a4bc8feb314156c2fd732d7c/href">https://medium.com/media/109504e2a4bc8feb314156c2fd732d7c/href</a></iframe><p>Thank you for reading! Feel free to reach out with questions and suggestions via the comments section.</p><p><strong>References:</strong></p><p>Plotting:</p><ul><li><a href="https://plotly.com/python/getting-started/">https://plotly.com/python/getting-started/</a></li><li><a href="https://plotly.com/python/choropleth-maps/">https://plotly.com/python/choropleth-maps/</a></li><li><a href="https://plotly.com/python/builtin-colorscales/">https://plotly.com/python/builtin-colorscales/</a></li><li><a href="https://plotly.com/python/reference/layout/geo/">https://plotly.com/python/reference/layout/geo/</a></li><li><a href="https://plotly.com/python/static-image-export/">https://plotly.com/python/static-image-export/</a></li><li><a href="https://towardsdatascience.com/how-to-embed-interactive-charts-on-your-medium-articles-and-website-6987f7b28472">https://towardsdatascience.com/how-to-embed-interactive-charts-on-your-medium-articles-and-website-6987f7b28472</a></li></ul><p>Data:</p><ul><li><a href="https://tradingeconomics.com/country-list/inflation-rate?continent=world">https://tradingeconomics.com/country-list/inflation-rate?continent=world</a></li><li><a href="https://data.worldbank.org/indicator/FP.CPI.TOTL.ZG">https://data.worldbank.org/indicator/FP.CPI.TOTL.ZG</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=52143b5593b7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>