Who I am and What Motivates me to Write

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…

Create useful Python apps in a few lines of code


PyWebIO is a Python library that makes it easy for you to create a web application like below in a few lines of code.

In the last article, I have introduced some basic usage of PyWebIO, but you might want to do more than just those basic functions. Luckily, PyWebIO 1.3.0 introduces more useful tools to create complicated interfaces in a few lines of code.

In this article, you will learn how to:

  • Add tabs for better navigation
  • Update one input based on the value of another input
  • Persist the input

To install PyWebIO 1.3.0, type:

pip install pywebio==1.3.0

put_tabs — Add Tabs for Better Navigation


All it Takes is a Few Lines of Code


Imagine you survey your employees about how much they like other employees on a scale from 1 to 10. However, you find it hard to understand the relationships between your employees by looking at the table below.

Wouldn’t it be nice if you could visualize their connections using an interactive network graph like below?

That is when pyvis comes in handy.

What is Pyvis?

Pyvis is a Python library that allows you to create interactive network graphs in a few lines of code.

To install pyvis, type:

pip install pyvis

Add Nodes

To add nodes to the network graph, simply use net.add_node(id…

Effortlessly Add Arguments to your Python Functions on the Command Line


Have you ever wanted to quickly add arguments to a Python script on the command line like below?

Being able to insert arguments to the Python script from a terminal allows you and your users to experiment with different parameters easily without looking at the source code.

argparse allows you to write command-line interfaces, but its syntax is long.

Is there a way that you can create command-line interfaces in one line of code like below?

That is when Typer comes in handy.

What is Typer?

Typer is a library for building Command Line Interface (CLI) applications based on Python’s type…

Minimize the number of workers per shift while assigning enough workers for each time window


Imagine you are a manager of a coffee shop. Your coffee shop opens 24h daily. The daily schedule is divided into 8 time windows as shown in the table below. Each time window requires a different amount of staff.

Staff members need to be scheduled into 4 different shifts like below:

How can you decide how many staff workers needed per shift?

It is easy, isn’t it?

You might say “That is easy! I will pick the highest number of demands among the three time windows in one shift…

Find any Files. Simply. Quickly.


Have you ever wanted to find files without leaving your terminal? find allows you to do so, but its syntax is complicated.

Wouldn’t it be great if you could search for files using a simple syntax like below?

That is when fd comes in handy. In this article, I will show you what fd is and how to use it to find any files quickly.

What is fd?

fd allows you to find any file quickly. fd is easier to use compared to find . Below is the comparison between the 2 commands.

Answer Repetitive Messages with your Personal Assistant


Have you ever wished to have a personal assistant to answer repetitive messages? You might be hesitant to do so because you don’t know where to start.

It turns out that creating a conversational assistant doesn’t need to be difficult. In this article, I will show you how to create one for yourself using Rasa.

What is Rasa?

Rasa is an open-source machine learning framework to automate conversations. With Rasa, you can create a robust model and deploy it using a few command lines.

To install Rasa, type:

pip install rasa

Now you can create a new project by typing:

rasa init


Stop using Words to Describe your Ideas. Use Drawings instead.


If you want your manager or colleague to understand your ideas for a project, don’t show them only words or a chunk of code. Use graphs or diagrams.

Imagine you want to explain with your manager the process of training a cat classifier, it would be easier for them to understand the flow of this process by showing them a picture like below.

Drawing is also a good way to outline what you want to do before tackling a project.

There are many tools to draw diagrams, but the one I like the most is Excalidraw. In this article, I…

A Python Interactive Shell with Autocompletion, Autosuggestion, Docstring, History Insertion, and Many More!


Have you ever wanted to quickly try some ideas popping up in your head using a Python Shell (REPL)? You might not want to open a new Jupyter Notebook to experiment with only a few lines of code.

But you might also be hesitant to use a classic Python shell since it doesn’t support auto-completion or docstring as Jupyter Notebook does. You also cannot fix the mistake in the code after hitting Enter.

What if you can turn your boring Python shell into a multi-functional shell like below?

That is when ptpython comes in handy.

What is Ptpython?

Ptpython can be considered as…

Simulate a Restaurant with Hungry Customers and a Limited Supply of Food


As a restaurant manager, you want to approximate how much food your restaurant needs to prepare for tomorrow. You know how many customers come to your restaurant per day and the average time it takes to serve one customer. However, it is challenging to put all of these variables into one calculation.

Wouldn’t it be great if you can simulate this event using Python?

That is when SimPy comes in handy.

What is SimPy?

SimPy is a Python library that enables you to simulate real-life events. It can model active components such as customers, vehicles, or agents.

To install SimPy, type:

pip install…

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