Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Use for data science questions related to the programming language Python. Not intended for general coding questions (which should be asked on Stack Overflow).

Python is a general-purpose, dynamic, strongly typed language with many 3rd-party libraries for data science applications. There are two versions currently in wide use: 2 and 3. Python 2 is the "old" version, with no new versions being released beyond 2.7, save bugfixes. Python 3 is the "new" version, with active development.

Python syntax is relatively easy to comprehend compared to other languages. For example:

numbers = [1, 2, 5, 8, 9]
for number in numbers:
    print("Hello world #", number)

Python has a clean look due to its regulatory approach to whitespace. While seemingly restrictive, it allows all Python code to look similar, which makes inspecting code much more predictable. All loops and conditionals (for, while, if, etc) must be indented for the code block that follows.

Popular scientific and data science packages include:

  • Numpy - A fast, N-dimensional array library; the foundation for all things scientific Python.
  • Scipy - Numerical analysis built on Numpy. Allows for optimization, linear algebra, Fourier Transforms and much else.
  • Pandas (PANel DAta) - A fast and extremely flexible package that is very useful for data exploration. It handles NaN data well as well as fast indexing. Handles a wide variety of external data types and file formats.

Code Language (used for syntax highlighting): lang-py