Who I am and What Motivates me to Write

Image of Author

Hello! I’m Khuyen Tran. I have been writing on Medium since December 2019, but I haven’t properly introduced myself so I wrote this article to do so.

I major in statistics, but I love playing with data science and Python tools and share them with others in my free time. Thus, I decided to write at least one article per week. At the point of writing this article, I have written a total of 105 articles.

What Motivates Me to Write?

I love open-source tools, but it can be difficult to understand what they do without spending hours on them. Thus, some cool packages are…

How Many Units Should You Produce Each Day to Minimize the Production and Inventory Cost?


Imagine you are an owner of a clothing store. The demand for clothes varies from day to day (more people prefer to go shopping on the weekend than on the weekday). The production cost also varies from day to day (it costs more to hire workers to work on the weekend).

Your job is to determine how many units of clothes to produce each day.

Image by Author

Since you can store your clothes, you might decide to produce as many clothes as possible on the cheapest day. …


Leverage your Python Skills to Understand the Skills and Requirements of your Dream Job


Have you ever wondered what the difference in the job requirements between data scientists and data engineers is? Instead of going through many job requirements to figure that out, why not use a tool to get descriptions of all data scientist and data engineer jobs at once?

That is when Diffbot comes in handy. In this article, you will learn how to extract 2k jobs related to data scientists and data engineers in one click, and visualize the difference in keywords between these 2 jobs using a scatter plot.

Image by Author

What is Diffbot?

Diffbot is a tool that allows you to extract a trillion…

Write High-Quality Code with black, flake8, isort, and interrogate


When committing your Python code to Git, you need to make sure your code:

  • looks nice
  • is organized
  • conforms to the PEP 8 style guide
  • includes docstrings

However, it can be overwhelming to check all of these criteria before committing your code. Wouldn’t it be nice if you can automatically check and format your code every time you commit new code like below?

Image by Author

That is when pre-commit comes in handy. In this article, you will learn what pre-commit is and which plugins you can add to a pre-commit pipeline.

What is pre-commit?

pre-commit is a framework that allows you to identify simple issues…

Forecast, Detect Change Points, Anomalies, and Get Key Statistics in Time Series


Time series analysis is a useful field in data science that allows you to understand the key statistics, detect regression, anomalies, and forecast future trends.

However, these time series techniques are often implemented by different libraries. Is there a way that you can get all of these techniques in one library? That is when Kats comes in handy.

Image by Author

What is Kats?

Kats is a lightweight, easy-to-use, and generalizable framework to perform time series analysis in Python, developed by Facebook Research. You can consider Kats as a one stop shop for time series analysis in Python.

To install Kats, type:

pip install --upgrade pip

Doing Python in a Functional Way


Have you ever tried to flatten a nested array like this?

If you found it difficult to flatten such a nested array, you would be happy to find an elegant solution like this:

Image by Author

…or to get the object of a deeply nested dictionary-like below in one line of code.

Assign Enough Airplanes while Minimizing the Cost using CVXPY


Imagine you are an owner of an airline. Your airline needs to assign its airplanes based in New York to cover all the upcoming scheduled flights.

There are 10 flights and 8 sequences of flights. Each sequence of flights consists of multiple flights.

For example, a sequence of flights can consist of flights from New York to Buffalo, from Buffalo to Chicago, and from Chicago to New York.

Data obtained from Applied Integer Programming by Chen, D.-S., Batson, R. G., & Dang, Y. (2010)
Image by Author

Each flight sequence has a certain cost. We need to select a subset of flight sequences…

Symbolically Solve an Equation and Calculus in Python

Image by Author


Have you ever wished to solve a math equation in Python? Wouldn’t it be nice if we could solve an algebraic equation like below in one line of code

[-1/2, 0]

…or simply work with math symbols instead of boring Python code?

Access useful Python snippets in one line of code


Data Science Simplified is a website I created that sends daily Python and data science tips to your mailbox. The tip is designed so that you can gain useful knowledge in 1 minute and go on with your day.

Image by Author

However, sometimes you might want to search for certain tips when needed without going to the website. Wouldn't it be nice if you can search and view a code snippet on the command line like below?

Fix your Typo in One Word, Save your Command-line Snippet, and Much More!


Command-line is a common tool for data scientists. Thus, knowing how to work with the command line efficiently will increase your productivity.

For example, when making a typo on the command line, wouldn’t it be nice if you can fix your mistake by typing only one word like below?

GIF by Author

In this article, you will learn 3 tools to make you more productive when working on the command line. They are:

  • thefuck — correct your previous command in one word
  • pet — save and execute your command-line snippet
  • yank — yank terminal output to the clipboard

thefuck — Correct your Previous Command in One Word

Typo is common when working…

Khuyen Tran

Data scientist. I share a little bit of goodness every day through daily data science tips: https://mathdatasimplified.com

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