A beginner’s guide for retail investors enthused by studying stocks

If you are a retail investor who is interested in the stock market, it is essential to research the stocks on your own. Yahoo Finance, among many other websites, provides stock data for users to interact with. For those who are versed with coding skills, there are a few API’s (application program interface) for programmatic access to Yahoo Finance data. yfinance, maintained by Ran Aroussi, is a Python module that provides access to multiple datasets.

This post will demonstrate some aspects of the yfinance module, and hopefully open the gateways for others to engage and explore.


I used pip to…

Python vs Mouse

Web scraping is a good way to obtain structured datasets from online sources, when desired structure does not readily exist for download. I have tried a few Python packages and my favorite is Beautiful Soup. I will use this post to document how I used it to scrape a corner of the U.S. News website, which is a source for various rankings (schools, hospitals etc.). The dataset I am aiming for is a detailed ranking of Pediatric Cancer hospitals, listed here. …

The power of prioritization and habit forming

<The One Thing> evolves around the idea of Priority, and, Prioritizing what you ultimately want to do. It expands the topic with how to do it and how it benefits you. Co-authored by Gary Keller, cofounder and chairman of Keller Williams Realty, one of the largest real estate companies in the world, and Jay Papasan, vice president of learning at Keller Williams and Keller’s writing partner for more works, the book is a rather inspiring read, if not a little too self-help-ish. And it is not a long, boring read like many others, totaling about 230 pages.

The One Thing, by Gary Keller and Jay Papasan. Image by EventBrite.

The One Thing

In honor of…

when Python 2 won’t cut it anymore

Recently, I have been increasingly using Python 3 for some projects at work as well as some personal endeavors. I have been loyally using Python 2, as a habit retained from the first time I learned Python. I have the Anaconda distribution installed on all Macs I touch, so to be able to switch between 2 and 3, the task became adding Python 3 to Jupyter and enabling coding in notebooks with the kernel of choice.

What Worked

Basically these 4 lines in Terminal did it for me:

python2 -m pip install ipykernel python2 -m…

One of my favorite hacks right now

Image source

The first time I learned about session variables was when I was trying to accomplish something like “find the top things with the n highest values in each group”. The article below gave me the idea (and the reference code) to make it happen.

Now, I’m occasionally using this to sort certain information that is not straightforward with a simple query. In addition, this is a great workaround to correlate information from different tables, where a simple join can’t do the trick. …

“The back of the lid of an open MacBook laptop” by Marcin Nowak on Unsplash

… when you have to do it

Wenyu Zhao

Data Science professional with experience in Finance, EV and Energy industries

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store