@rye
SWE is mostly just Systems Engineeing in software, especially in the high level.
Data Science is a totally different subject than Software Engineering, I don't know why you are reading data science books unless you want to become a data scientist.
in general software engineering involves: Designing the solution/system/software (through documents, UML diagrams, concept prototypes, etc), Implementing (coding, devising algorithms, etc), testing (unit tests, integration tests, etc), deployment. Alot of other things too.
For your photo of code, well it looks good, but I don't have any context of where this code will be used or what software it is part of. You can follow guides like Python's PEP 8, or some other standard which says how to structure your code, name variables, etc.
what your doubt specifically?