point8 / data-science-learning-paths

Practical data science courses - from basic to intermediate
Other
23 stars 3 forks source link

Add "Advanced Python DS Ecosystem" course materials #3

Open ccauet opened 9 months ago

ccauet commented 9 months ago

@clstaudt we created some new content for a customer covering topics from oop, poetry, databases, polars, and dashboards.

Would you be interested to have a look over the material and give some feedback before we merge?

clstaudt commented 9 months ago

@ccauet Certainly. There might even be some thematic overlap with new material I am building.

clstaudt commented 9 months ago

Polars material

Not quite in the familiar form of notebooks from Data Science Learning Paths yet:

Technical:

Nice to have: Comparison of PySpark and Polars API - since they look very similar.

clstaudt commented 9 months ago

Object Oriented Programming material

allows us to organize code around real-world entities.

Really? A bit vague and misleading. Start with the idea of grouping data and logic together.

Python uses access modifiers to define the visibility of attributes and methods, helping to encapsulate data and ensure that unwanted changes cannot be made from outside the class.

C++ and Java have access modifiers that enforce visibility rules. The conventions explained here are usually not called like that. Suggestion:

In Python, naming conventions are used to indicate the intended visibility and accessibility of attributes and methods, rather than strict access modifiers.

Also, this is not strictly correct:

Can only be accessed within the defining class, denoted by a prefix of double underscore

Instead of:

Polymorphism is the ability of interacting with different objects, from different classes, through a common interface (methods).

... consider:

Polymorphism is the ability of objects from different classes to be treated as instances of the same class through a common interface (methods).

Nice to have: A more elaborate example where an OOP design really makes code elegant and easy to manage. For example the state machine design pattern -> check out https://github.com/clstaudt/cpp-patterns/blob/main/State/music.py

Nice to have: A practical example for how OOP is used in a data science library. For example, scikit-learn Estimators and Transformers. Exercise: Build your own Estimator...

clstaudt commented 9 months ago

1. Development of Python Packages with Poetry****

material missing or not linked in the TOC?

clstaudt commented 9 months ago

Working with Databases

ORM: SQLAlchemy

- "pyramid scheme" but "database schema"

NoSQL databases with PyMongo

Pandas + SQL(Alchemy)

This explains pandas + SQL. If we are already using SQLAlchemy to interact with the DB, should I write raw SQL queries to read data into pandas or rather something like this?

# Using the session in a with statement
with Session() as session:
    # Inserting data
    sample_users = [User(name="Alice", age=30), User(name="Bob", age=25), User(name="Charlie", age=35)]
    session.add_all(sample_users)
    session.commit()

    # Querying data
    users_query = session.query(User).all()

# Convert the query result to a pandas DataFrame
df = pd.DataFrame([(user.id, user.name, user.age) for user in users_query], 
                  columns=["ID", "Name", "Age"])
clstaudt commented 9 months ago

streamlit

Would be great to have a streamlit example here, but this particular demo may be too German for this repo...

Nice to have: Demo that shows off a lot of the interactive stuff you can do with streamlit.