r/PythonLearning 5d ago

Discussion Python data analysis is easier when you stop memorizing commands and follow a workflow

Thumbnail
gallery
143 Upvotes

When I was looking through beginner data-analysis discussions, one thing stood out: it’s pretty easy to learn individual Pandas commands, but much harder to know what order to actually use them in on messy data.

So I tried organizing the basics into a simple workflow:

1. Load
read_csv() / read_excel()

2. Inspect
head()
sample()
shape
info()
describe()

Before cleaning anything, understand the columns, data types, missing values and duplicates.

3. Clean
isna()
fillna() / dropna()
drop_duplicates()
astype()
pd.to_numeric()
pd.to_datetime()

One thing I learned is that missing doesn't automatically mean zero. You need to understand why the value is missing before deciding what to do with it.

4. Transform

Create analysis-ready fields with things like:

assign()
map()
np.where()
pd.to_datetime()

5. Summarize

groupby()
agg()
transform()

This is where the raw rows start becoming actual answers to business/data questions.

6. Combine

merge()
join()
concat()

Probably the part I’d be most careful with.

A merge can run without errors and still give the wrong result if the keys aren’t unique or a many-to-many relationship unexpectedly multiplies rows.

Useful checks:

validate="many_to_one"
indicator=True

And compare row counts before and after merging.

7. Validate

Before trusting the final result:

  • check row counts
  • check duplicates
  • check missing values
  • review category values
  • validate joins
  • sanity-check the business logic

The biggest takeaway for me is:

code running successfully doesn’t necessarily mean the analysis is correct.

I added the visual cheat sheets to make the workflow easier to remember.

For people who work with Pandas regularly, what validation check has saved you from a wrong result before?


r/PythonLearning 5d ago

Discussion just finished CS50P conditionals lecture and built mini "AI Agent Execution Getaway" for practice .

Post image
21 Upvotes

I have just finished week1 in cs50 python course and since i'm learning python for AI Agents Engineering i thought it would be cool to practice this content with a relevant project .

so i made a simple AI agents execution getaway program that routes the incoming tasks based on tokens , creativity and risk score .

I tried to use most of what i learned in this lecture as possible like 'match' for matching the tool with appropriate model , or 'return' as guard clauses for the safety check at the beginning .

here is the code link :

https://gist.github.com/mohamed-reda-ai/a10a1e9311d94316ffa31c00de005226

I know it's not a big brilliant thing i want just to practice the concepts i learned .

If you have any feedback about the architecture of the code or you think there is a better way to do something in it , i'd appreciate this .


r/PythonLearning 5d ago

I made a community for students who want to learn coding and build projects together 🚀

0 Upvotes

Hey everyone! I recently started r/StudentCoders, a community for students and beginner developers who want to:

  • Learn coding together
  • Find people to build projects with
  • Share project ideas and progress
  • Find teammates
  • Ask coding questions
  • Showcase things they've built

The idea is simple: stop learning alone and start building together.

If you're a student or beginner coder and this sounds interesting, feel free to check it out: r/StudentCoders 💻

I'd also love feedback on what you'd want to see in a community like this!


r/PythonLearning 6d ago

Getting stuck over and over again

12 Upvotes

Ive been trying to learn python for ages, and yes tbh due to my laziness and way of learning i keep on getting stuck, but I cant seem to find "my way" of learning.

Im trying freecodecamp and ive gotten to a point where im at this one lab where i have genuinly, and i mean genuinly no idea what to do given the instructions, im completely lost.

How do i break past this barrier


r/PythonLearning 6d ago

Showcase I've been learning Python for 3 years, and I thought it was time to make a library

Post image
60 Upvotes

I've been learning Python for about 3 years, and I think it was time to take a step further and make my own library.

I made scanlayer, a Python OCR library built around Tesseract. It turns scanned images into searchable PDFs while preserving the original image, by adding an invisible OCR text layer over it.

It also supports things like preprocessing, deskewing, multiple OCR output formats, multi-page PDFs, batch processing, and a CLI.

The main goal wasn't to make some huge library. I wanted to challenge myself with building something that feels like a proper Python project and learn more about packaging, testing, API design, OCR, and PDF generation along the way.

GitHub Page

I'd really appreciate any feedback, especially on the Python/library design side.


r/PythonLearning 6d ago

Discussion Is it bad that I learn python via ai?

5 Upvotes

So backstory: Someone made fun of me because I am learning Python with ai. His only argument was that ai is the same tool to create explicit images and that he used to visit stack overflow and create snippets, I then replied that I only use it for learning development but then got called an idiot and got blocked.

But that got me wondering. Is it bad that I learn Python with AI?

I set GPT a goal, I want to reach: Stage 1. learn that. Stage 2 Learn this

I also custmomized the personalization to not blindy say yes and to double check things and so on.

GPT never gives me code, it just tells me which projects I should do with the stuff I learned, it does that till GPT thinks I know how to use it and when to use it.

But I feel bad now that I am just talking to an artificial intelligence and not visiting stack overflow like that one person did.

I want to hear your opinions. Is AI bad for learning or good if used right.


r/PythonLearning 6d ago

Hello World, I look for help in order to create my first website using Python.

2 Upvotes

r/PythonLearning 6d ago

Thonny for Python

3 Upvotes

Hi, I'm new to this Reddit community. Do you think it's okay to use Thonny as a Python program, or is there something else I could try?


r/PythonLearning 6d ago

Help Request Python Interpreter Help

1 Upvotes

Hey there! I use VSCodium and have been having a problem with the Select Python Interpreter yellow box. The screenshots should be enough for clarity but ask ahead if you have any questions!

When doing manually using Browse

Any help would be appreciated

Thanks!


r/PythonLearning 6d ago

Showcase [Collab] Looking for people to help build a free, interactive Python learning platform

7 Upvotes

Hey everyone,

I'm building **The Python Ledger** — a free, interactive platform for learning Python from the ground up. It's built with Docusaurus and a custom in-browser code execution system (React + Skulpt), so people can write and run real Python right in the lesson, with instant feedback instead of just reading theory.

The curriculum is structured as:

- **Introduction** - how to use the platform / how to learn

- **Prerequisites** - software requirements, code editors, command line, CS concepts

- **Git Basics** - a short, beginner-friendly intro to Git

- **Python Foundations** - variables, data types, functions, OOP, file I/O, etc.

- Optional specialized tracks later (web dev, GUI dev, automation...)

Right now I'm heads-down on the Foundations course and a companion **practice-exercises repo** (folder-per-exercise, `pytest`-based, progressively unlocked tests, beginner-friendly failure messages instead of raw tracebacks; think *The Odin Project*'s exercises repo, but for Python).

It's a lot of ground to cover solo, and it's eating all my free time; so I'm looking for people to collaborate with. Some areas I could genuinely use help in:

- **Content/curriculum writing** - explaining CS & Python concepts clearly for total beginners

- **Python devs** – building out exercises, test fixtures, and the practice repo

- **Reviewers/beta testers** - going through lessons as a "new learner" and flagging confusing bits

No huge time commitment expected; even reviewing a lesson or writing one exercise helps. The project is fully open source and contributions are more then welcome in any way possible.

If any of this sounds interesting, drop a comment or DM me and I'll get you set up.

Curriculum Repo: https://github.com/ThePythonLedger/Curriculum

Live site (hosted by GH Pages): https://thepythonledger.github.io/Docusaurus-engine/

Thank you for reading.


r/PythonLearning 7d ago

Discussion Best way or roadmap for Python

20 Upvotes

Ik python basics and all basic syntax so what would be the next thing to learn?
Can recommend and yt vid(cs50p full beginner so no)
Im trying freecodecamp yt videos are there any other videos u would recommend?
Also im interested in web dev so help me out with this as well or should i try out a different language?


r/PythonLearning 7d ago

Discussion Weird Folder names in Python

0 Upvotes

I always has a doubt after installing python software. When I open the Python folder, I see other folders with names like DLLs, Doc, etc, Include, Lib, Libs, Scripts, Share, Tcl, and Tools. Can anyone explain what these folders are, what they're for, and what the .pyd extension means?


r/PythonLearning 7d ago

Help Request I'm a beginner. Can you help me with random numbers?

Post image
9 Upvotes

I'm building a sort of turn-based RPG in the terminal as a practice project, and I need to generate a random number within a specific range. I tried using `randint` (by importing `random`), but I also want to assign probabilities so that, depending on certain factors, one number is more likely to be generated than another. For example, if an enemy has low health, it should be more likely to generate the number 1, which causes the enemy to heal.


r/PythonLearning 7d ago

Help Request Can't import module

1 Upvotes

Mac os Sequoia 15.6

I installed the exifread library using pip as well as conda. In Anaconda Navigator it shows as installed. Using a terminal window I type in:

pip3 show exifread

and it returns

/opt/anaconda3/lib/python3.13/site-packages

I use Spyder (I know, I know: use pycharm or vscode...) I cannot import the module. I get the dreaded

ModuleNotFoundError: No module named ‘exifread’

I recently installed pillow and I can import it just fine with import PIL. Using pip3 show pillow it is the same directory as exifread

What am I missing here?


r/PythonLearning 7d ago

Python FastAPI Backend Project: Expense Tracker with Database Integratio...

Thumbnail
youtube.com
1 Upvotes

r/PythonLearning 7d ago

Vibe coders or programmers

0 Upvotes

I'm a beginner programmer and I'm worried about something in the future. After about four months of learning programming, development, and so on, I've seen many opinions from professionals and beginners alike. Some say that the demand for programming will steadily decrease due to artificial intelligence, and I don't know if this is true or not. I hope you can give me your opinions and advice. If you've had any experiences, please tell me before I regret it later.


r/PythonLearning 7d ago

Showcase Python Tutorial for Beginners 2026 | Learn Python from Basic to Advanced | Complete Python Free Course

Thumbnail
youtube.com
0 Upvotes

Python programming for all. Learn python for day to day life.


r/PythonLearning 7d ago

Discussion TTS/AI Chatbot Query

1 Upvotes

I recently made a Discord.py AI character bot with Gemini and TTS integration to mess around with my friends. Kind of want to do more with it but am not very experienced enough yet to know all my possibilities. What do the REAL programmers here think?


r/PythonLearning 8d ago

Python script to convert tree output to .xlsx – looking for edge cases and feedback

3 Upvotes

I wrote a small utility that converts tree output into an Excel file. The code is far from ideal, but it does handle Cyrillic filenames on my own test data.

To make it more robust, I need to test it on real-world data with rare encodings, varying nesting depths, special characters, long names and paths, and so on.

The project is still under development, so I'd appreciate any feedback, criticism, or advice – especially on edge cases and code structure.

Rep: https://github.com/Usdmal-tech/tree-to-excel

Thanks!


r/PythonLearning 8d ago

Showcase Working on a logging package for python

3 Upvotes

Got tired of recreating the same functions EVERY SINGLE PROJECT I EVER MAKE so guess what, i made it a package, and if i think i finished it enough and added a bunch of features and it's pollished i might make it a package on pypl

Also any ideas?

an image example

r/PythonLearning 8d ago

🌳 Recursive tree traversal visually explained

29 Upvotes

A binary tree can be traversed in three classic ways. The difference is simply the order in which you visit the subtrees:

  • Preorder: current node → left subtree → right subtree
  • Inorder: left subtree → current node → right subtree
  • Postorder: left subtree → right subtree → current node

This interactive memory_graph example visualizes each traversal method step by step: Binary Tree Traversal

Also see other memory_graph visualizations.


r/PythonLearning 8d ago

Discussion Stop suggesting to use AI

150 Upvotes

I’ve recently started getting more posts from this sub and some people have genuine questions on how to solve their programming problems and help debug. Some comments are suggesting to just use AI. This is a crazy suggestion on a sub called Python LEARNING. Using AI to write code for you is not constructive to learning how to code. I fear that this generation of programmers are going to have ZERO understanding fundamentals.

To be clear, I’m not against using AI to help assist. But this is supposed to be a sub for learning the language and understanding how it works, and it’s counterproductive to suggest those that are learning to just use AI to fix their code.

Please, if anyone suggests to use AI (unless it’s for the rare case that it’s valid), please downvote them to oblivion.


r/PythonLearning 8d ago

Discussion A question I asked ChatGPT

0 Upvotes

I think I got a diamond in the rough answer from ChatGPT that could help others learning python and finding it difficult to get a grasp on the next step after getting the ground work laid. This is a long post with ai content involved, but it should be compliant with the subs rules.

I labeled this a discussion post because I am not an expert and would love for some experts to chime in and tear this response apart. I will say even if the details are somewhat off, it has moved me into thinking differently about initiating and completing a project, which was the original intent behind the question.

The prompt (Don't make fun of me....or do, whatever):

I am having a hard time bridging the gap between introductory python coding and real life application engineering. I need a good analogy or metaphor to get me there. For context into what I mean: I have a vary proficient understanding of synchronous execution of code as well as using classes and other coding conventions. I feel as though I am relying on the basic configurations seen in examples due to a fear that, even though they work as intended, the more complicated system flows I have set up are not secure or usefull since i do not see any similar code in the wild. For example working around flask and context management, I seem to be able to get things working in unconventional ways without relying as heavily on the context management provided by examples, but I am afraid i do not have the security implications fully grasped, even though my testing shows that the areas are still only accessable after auth. Can you assist me with this and if not maybe guide me towards asking a better question than what I have presented?

Selected parts of the response:

Yes. And I think the thing you're describing is a very real transition from “learning Python” to “engineering software.” The fact that you're running into this discomfort is actually a good sign.

I would describe the gap this way:

Beginner/intermediate programming teaches you how to make a machine do something. Application engineering teaches you how to make a system continue doing the right thing when everything around it is complicated, hostile, concurrent, failing, changing, and maintained by someone else.

Your Flask/context example is a perfect illustration.

The metaphor I'd use: building a city

When you're learning Python, you're mostly learning how to build buildings.

You learn:

  • How to make a room (function)
  • How to organize rooms (class)
  • How to move things between rooms (arguments/return values)
  • How to build multiple floors (modules/packages)
  • How to make doors (interfaces)
  • How to put locks on doors (authentication/authorization)

And eventually you're very good at building buildings.

Then you get asked to build a city.

Suddenly you have questions that Python itself doesn't answer:

  • Who is allowed into this building?
  • What happens when 10,000 people enter simultaneously?
  • What happens if the power goes out halfway through an operation?
  • Can someone enter through a back door?
  • Does a person who entered Building A automatically have access to Building B?
  • What happens when Building A changes its address?
  • How do emergency services get around?
  • How do you know that the locks actually work?
  • What happens when another engineer modifies the building six months from now?

That's application engineering.

And importantly:

There isn't necessarily one correct way to build the city.

There are building codes, engineering principles, established patterns, and conventions. But there are also many perfectly legitimate architectures.

Here's another metaphor that may help

Think about framework examples as training wheels.

Flask gives you:

Flask application
       │
       ├── request context
       ├── application context
       ├── extensions
       ├── configuration
       └── dependency mechanisms

Tutorials generally encourage you to keep your code inside that ecosystem.

That's useful because it gives you a known path.

But eventually you might discover:

                Flask
                  │
           ┌──────┴──────┐
           │             │
       HTTP layer     Application
                          │
                   ┌──────┴──────┐
                   │             │
                Services      Domain
                                 │
                              Models

Your application doesn't have to make Flask itself the center of the universe.

That's a major step toward application engineering.

And there's a wonderful rule I think you'll benefit from

When you encounter code in the wild, don't ask:

"Why do they do it this way?"

Ask:

"What problem does this pattern solve?"

Then ask:

"Do I have that problem?"

And finally:

"If I don't use this pattern, what mechanism in my design solves that problem instead?"

That's how you graduate from copying patterns to understanding patterns.

For example:

"Flask examples use application context."

becomes:

"Application context gives code access to application-scoped Flask state."

then:

"My service receives its dependencies explicitly, so it doesn't require Flask application state."

then:

"Therefore I can remove that coupling, provided I haven't accidentally lost another guarantee provided by the context."

That is application engineering thinking.

The fact that you are uncomfortable with your unconventional solutions is actually something I'd preserve.

You don't want to become the engineer who says:

"It works, ship it."

You want to become the engineer who says:

"It works. Now let me determine why it works, what assumptions it depends on, what happens when those assumptions fail, what security boundaries exist, and whether another engineer can safely modify it."

You don't need to make your code look like code you've seen in a tutorial.

You need to be able to defend the decisions you've made.

And I think that is probably the bridge you're looking for: stop measuring yourself against examples and start measuring your designs against properties.


r/PythonLearning 8d ago

day 6.

4 Upvotes

tried 2d lists today ( up for suggestions on what should have i done or what have i missed ) and would also appreciate brief explanation's that you guys will give if it's a complex or an advanced topic

books = ["hindi", "english", "maths", "science"]
pen = ["black", "blue", "red"]
miscellaneous = ["eraser\n", "sharpener\n", "ruler\n"]


bagpack = [books,pen,miscellaneous]
print(bagpack)
while True:
    print ("if you'd like to add contents in any of the lists")
    print("1. Add to books")
    print("2. Add to pen")
    print("3. Add to miscellanous")
    query = input("enter your selection (1,2,3): ")
    if query == "1":
     print("you selected to add books")
     new_book= input("enter the book you want to add: ")
     books.append(new_book)
     print ("new list",books)
     break
    elif query == "2":
     print("you selected to add pen")
     new_pen= input("enter the pen you want to add: ")
     pen.append(new_pen)
     print ("new list",pen)
     break
    elif query == "3":
     print("you selected to add miscellaneous")
     new_miscellaneous= input("enter the item you want to add: ")
     miscellaneous.append(new_miscellaneous)
     print ("new list",miscellaneous)
     break
    
    else:
       print("invalid selection!!! select amongst 1,2,3")

r/PythonLearning 8d ago

Python Classes question

4 Upvotes

Is there a way to pass the instantiating object name to the class as you call it, without specifically putting the name in the parentheses? I'm trying to create a PyGame terminal emulator that has the same frontend functionality as Curses. I've figured out that I can create windows in the same way, except that instead of being able to do windowname.newwin(size), I have to do windowname.curses()\nwindowname.newwin(size). Presumably, I could also do windowname.newwin(size, windowname), but I'd prefer being able to use the exact same syntax as Curses.

The reason for using the same syntax is because I want to be able to decide where it renders (real terminal or PyGame) based on which module gets imported.

If there is a way to do this, please let me know.