Python is dominating the data science ecosystem. What I think the top two reasons for such dominance are being relatively easy to learn and the rich selection of data science libraries.

Python is a general purpose language so it is not just for data science. Web development, mobile application and game development are some use cases for Python.

If you are using Python only for data science related tasks, you do not have to be a Python expert. However, there are some core concepts and features that I think you must have in your possession.

What we cover in this article is not library-specific. They can be considered as base Python for data science. Even if you are only using Pandas, Matplotlib, and Scikit-learn, you need to have a comprehensive understanding of Python basics. Such libraries assume you are familiar with Python basics.

I will briefly explain each topic with a few examples and also provide a link to a detailed article for most of the topics.

1. Functions

Functions are building blocks in Python. They take zero or more arguments and return a value. We create a function using the def keyword.

Here is a simple function that multiplies two numbers.

def multiply(a, b):
  return a * b

multiply(5, 4)

Here is another example that evaluates a word based on its length.

def is_long(word):
  if len(word) > 8:
     return f"{word} is a long word."

'artificial is a long word.'

Functions should accomplish a single task. Creating a function that performs a series of tasks defy the purpose of using functions.

We should also assign descriptive names to functions so we have an idea of what it does without seeing the code.

#python #data-science #machine-learning

10 Must-Know Python Topics for Data Science
10.05 GEEK