A concise function to transfer text to number in DataFrame

Photo by the author

Today I want to share a concise function that can transfer text to numbers. Let’s show the original and target data first to get the direct impression.

The original dataset is like below: