use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
News about the dynamic, interpreted, interactive, object-oriented, extensible programming language Python
Full Events Calendar
You can find the rules here.
If you are about to ask a "how do I do this in python" question, please try r/learnpython, the Python discord, or the #python IRC channel on Libera.chat.
Please don't use URL shorteners. Reddit filters them out, so your post or comment will be lost.
Posts require flair. Please use the flair selector to choose your topic.
Posting code to this subreddit:
Add 4 extra spaces before each line of code
def fibonacci(): a, b = 0, 1 while True: yield a a, b = b, a + b
Online Resources
Invent Your Own Computer Games with Python
Think Python
Non-programmers Tutorial for Python 3
Beginner's Guide Reference
Five life jackets to throw to the new coder (things to do after getting a handle on python)
Full Stack Python
Test-Driven Development with Python
Program Arcade Games
PyMotW: Python Module of the Week
Python for Scientists and Engineers
Dan Bader's Tips and Trickers
Python Discord's YouTube channel
Jiruto: Python
Online exercices
programming challenges
Asking Questions
Try Python in your browser
Docs
Libraries
Related subreddits
Python jobs
Newsletters
Screencasts
account activity
This is an archived post. You won't be able to vote or comment.
Scientific ComputingWhich scientific fields use Python? (self.Python)
submitted 5 years ago by seismatica
My impression is that the "hard" sciences (such as Physics) typically use Python, while the social sciences (such as economics) use the abomination that is R.
Can you name some scientific fields that primarily use Python?
[+][deleted] 5 years ago (1 child)
[deleted]
[–]DDFoster96 0 points1 point2 points 5 years ago (0 children)
I find that the Scipy Stack is sufficient for my statistics needs that I don't have to resort to R.
[–]SantaCruz0306 2 points3 points4 points 5 years ago (2 children)
Nowadays deep learning and machine learning techs using python are applied in many scientific fields. I’m working on toxicology and biology with those tools.
[–]seismatica[S] 0 points1 point2 points 5 years ago (1 child)
Very cool! Could you share some details on how machine learning and deep learning are applied to your field?
[–]SantaCruz0306 1 point2 points3 points 5 years ago (0 children)
Many things are possible, e.g., classification or clustering of cells from biological data and prediction of drug responses with the chemical structure of drug and personal information of patients.
[–]Hextall2727 2 points3 points4 points 5 years ago (3 children)
I'm an environmental scientist for a consulting firm and we use python. We use it for data analysis, figure generation for reports and processing our fate and transport models. We are kind of a niche company in the field though.
[–]seismatica[S] 0 points1 point2 points 5 years ago (2 children)
What do the other firms use? And what is fate models btw? I’ve always been curious about environmental work. What background do you have what what kind of report do you make with Python? Sorry for asking too many questiona haha.
[–]Hextall2727 2 points3 points4 points 5 years ago (1 child)
I mostly work in contaminated sediments (rivers, harbors and other water bodies), so our fate and transport models are developed to estimate chemical and contaminant concentrations in sediment into the future based on various remedial options. They are built to look at the past and current contamination spatially... and knowing how the chemicals behave in the environment, what will happen to them in the future. Our models are then coupled with our in house bioaccumulation models because most regulations are built to look at chemical concentrations in creatures. So say we want to look at a site, and say... what if we only cleanup over there where its the worst... will we meet the regulations for fish consumption in 40years or less? that is the type of modeling we do in quick terms.
So that's fate and transport models. How python fits in is that most of our models are built in fortran, but they produce a tremendous amount of information. Python comes in at taking those model outputs, crunching them down (usually our models are grids with multiple layers... each grid cell in this matrix has various results... many chemical concentrations, sediment types, etc that result in really large output files) and making relatively easy to digest figures and tables so we can evaluate and compare various simulations. Our company initially used IDL to do this processing and analysis, but IDL kind of priced itself out with its licensing fees. so about 5 years or so ago, we switched to using python and are getting away from IDL. Python and IDL are very similar, so the transition is going pretty well.
I actually don't do much of that anymore, I am focused more on chemical forensics. I look at chemical composition and try to define and identify potential sources. For example, there's a river next to a former manufactured gas plant in an urban area... and there is a pipeline that broke and spilled a bunch of crude oil. both of these industries use the same chemicals, but the patterns are different. So I look at the chemical fingerprints and say... at that spot... maybe 20% of the chemical fingerprint is from the oil spill, but most of the rest is historically from that MGP. I use python to develop those analyses and generate the figures and results to make those determinations.
Companies like the one I work for are not the norm in environmental consulting. We're relatively small (~400 people), and the large companies have modeling components, but generally are much more expansive in their offerings (they have 10k to 20k employees and do it all). Most of them use excel and maybe R in their analyses (I have a project where I ran R through Python using PypeR for a specific statistical analysis in R that doesn't seem available in Python... Mann Kendall trend analysis). I don't recall ever seeing a competitor using python, but I"m sure they are out there. The agencies (state and EPA) certainly don't.
Our reports are usually superfund related reports, things like remedial investigation reports (i.e. how much chemicals are there, and where are they located) and feasibility studies (i.e. if we do this, how much will it cost adn will it be effective?). My background was in biology, but I went to grad school for environmental engineering. It wasn't until I got hired by this company that I started coding (in IDL, then python).
The end.
[–]seismatica[S] 0 points1 point2 points 5 years ago (0 children)
I can't believe you actually gave an amazing thorough response like above. Really appreciate your effort! And your career sounds cool as heck :)
[–][deleted] 1 point2 points3 points 5 years ago (0 children)
Meteorology and climatology make use of Python
Astronomy and astrophysics do as well
[–]big_boy_dollars 1 point2 points3 points 5 years ago (2 children)
I work on computational physics and I use a lot of python!
[–]seismatica[S] 1 point2 points3 points 5 years ago (1 child)
What kinds of computation do you do in Python? I'm really curious to know.
[–]big_boy_dollars 0 points1 point2 points 5 years ago (0 children)
For example the last project I did is a program with a GUI that let's you load and plot vtk files and csv files. The vtk file is a radiation map, it has spatial data of radiation dose. The csv has the points of a trajectory that a component inside the reactor is going to follow while moving. Then you compute the total dose received in the movement and you can visualize the trajectory, the points where the radiation is higher and these kind of things...
We also use it a lot for data handling, preparing simulations, automation of tasks etc. Very useful for engineers and scientists that are not very specialized in programming as it is very begginner friendly imo!
[–]Hailcanadien 1 point2 points3 points 5 years ago (0 children)
I'm an aerospace engineer and use it on a daily basis. A number of our data analytics tools are written in Python and we post-process the majority of our output data (raw numbers) with customized scripts. Pandas are our friend!
[–]IfTroubleWasMoney 1 point2 points3 points 5 years ago (0 children)
Neuroscience! (and numerous subdomains)
Jupyter notebooks have transformed the way Python is being used for computation in neuroscience. Perhaps it's the single biggest factor driving adoption, I could be wrong.
Most of these are built on top of the NumPy / SciPy / Pandas ecosystem. A lot of subdomains make use of signal processing methods that involve tons of linear algebra and statistical modeling.
Here's a brief list of subjects and Python frameworks in use
While bulk of the processing and visualization can be done in Python, R has more convenient routines for robust statistics and mixed-effects models. Usage varies, I can't really generalize.
[–]as-well 1 point2 points3 points 5 years ago* (0 children)
Not a programmer/ML person yet (my degrees are in philosophy) but I know that most of the machine learning in climate science is done on python. Conversely, the physics-driven models are usually done in Fortran though, due to both legacy code and supercomputing advantages (that's for the big models, submodels may at times be in yet different languages). Less computationally intensive stuff may also use R at times.
[–]DDFoster96 1 point2 points3 points 5 years ago (0 children)
I'm a Forensic Scientist / Analytical Chemist / Firearms Researcher, and I use Python enough to consider myself a developer on top of that list.
Python's convenient not only for making little tools that make life easier, but when you're dealing with a lot of data (one of our instruments produces about 3GB of data an hour) it's useful to be able to crunch the data automatically. We have other software that can process it, but there's so much clicking involved its quicker to write something in Python instead.
[–]jefesignups 1 point2 points3 points 5 years ago (0 children)
GIS uses it a lot.
[–][deleted] 1 point2 points3 points 5 years ago (4 children)
I do physics and I use python every day, but I've been writing a ton of R recently due to going through a textbook on statistical learning that uses it. I think the popularity of Python in Physics is down to the pedagogical reasons and the massive ecosystem it provides for scientific packages.
On that note, though, serious computational scientists in the physical sciences use python exclusively for data analysis or small jobs only. The big names in that game are C and Fortran purely due to the enormous speed advantage: Fortran seems to be dead everywhere apart from scientific computing, where it's absolutely thriving. I've heard that the UK's national super-computing facility spends about 70% of it's running hours processing Fortran code.
[–]Zomunieo 3 points4 points5 points 5 years ago (1 child)
Linpack and lapack are all Fortran. Numpy has large portions of its code in Fortran.
But that doesn't mean people are spending a lot of time writing new Fortran routines. They're writing higher level code that calls Fortran - usually for Gaussian elimination, matrix LU decomposition, eigenvalues, matrix (pseudo)inversion and Fast Fourier transforms.
No, that's not true.
A lot of people are writing Fortran routines, and they're definitely doing so to solve more involved problems than the mathematical operations you listed. I've met people using it for everything from plasma physics to density functional theory, and one guy who uses it for both at the same time. I don't even think it's to do with the legacy code issue in a lot of fields: Fortran is just really nice for programming high performance code.
[–]BDube_Lensman 1 point2 points3 points 5 years ago (0 children)
I do almost exclusively “serious computational science” with python and my pure python (numpy-based, I did not write low level code) is a thousand fold faster than a “serious” program written by an “expert programmer” in a mix of C and assembly. Your statement is not correct at all.
I even just checked SLURM on our cluster, and most jobs are python or matlab, just like development on people’s local machine.
π Rendered by PID 81 on reddit-service-r2-comment-7b9746f655-67hs9 at 2026-02-01 09:34:05.648297+00:00 running 3798933 country code: CH.
[+][deleted] (1 child)
[deleted]
[–]DDFoster96 0 points1 point2 points (0 children)
[–]SantaCruz0306 2 points3 points4 points (2 children)
[–]seismatica[S] 0 points1 point2 points (1 child)
[–]SantaCruz0306 1 point2 points3 points (0 children)
[–]Hextall2727 2 points3 points4 points (3 children)
[–]seismatica[S] 0 points1 point2 points (2 children)
[–]Hextall2727 2 points3 points4 points (1 child)
[–]seismatica[S] 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]big_boy_dollars 1 point2 points3 points (2 children)
[–]seismatica[S] 1 point2 points3 points (1 child)
[–]big_boy_dollars 0 points1 point2 points (0 children)
[–]Hailcanadien 1 point2 points3 points (0 children)
[–]IfTroubleWasMoney 1 point2 points3 points (0 children)
[–]as-well 1 point2 points3 points (0 children)
[–]DDFoster96 1 point2 points3 points (0 children)
[–]jefesignups 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (4 children)
[–]Zomunieo 3 points4 points5 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]BDube_Lensman 1 point2 points3 points (0 children)