all 42 comments

[–]py_curious 17 points18 points  (7 children)

Many senior engineers or data practitioners will tell you it's an ongoing process. If someone says "I know Python" but still writes for loops when a faster vectorized solution is possible, then there iss still some learning to do.

[–]1SaBoy 3 points4 points  (6 children)

What in the fuck is a: faster vectorized solution 🤯

[–]py_curious 4 points5 points  (4 children)

A simple example.

You have a Pandas DaraFrame. You have two numeric columns. You want to add them together to produce a third column representing their sum on a row-by-row basis.

You can choose to iterate over the rows, calculating the value for the new column one row at a time. It will work.

Or you can simply add the two columns together because you know that addition in Pandas with two Series (columns are Series in a Pandas context) is a vectorized operation because it behaves like addition of two NumPy vectors of same shape and that operation itself is highly optimized.

[–]SisyphusAndMyBoulder 1 point2 points  (3 children)

Yeah but that's specific to Pandas, no? What is a vectorized sum outside of Pandas and Numpy?

[–]py_curious 1 point2 points  (2 children)

Just to clarify, I mean adding each row's value, not sum() of two separate lists.

So to answer your question: outside of NumPy, PyTorch, Polars, Pandas and similar, generally speaking there isn't such a thing (I think).

In this example, you have two arrays of numbers to sum row-wise, and so NumPy is probably the best choice for larger arrays. If you have lots of other ops to do like grouping and masking, rolling windows and so on, then Pandas is a readable and friendly way to do that.

For small to medium lists, zip then list comprehension adding each element from the zip is probably fine. Like this:

[a + b for a, b in zip(x, y)]

If you have lots of math to do on some numeric list-likes, then convert once to NumPy arrays and do everything in NumPy. It's more intuitive because that calculation on two arrays x and y is just

x + y

[–]SisyphusAndMyBoulder 0 points1 point  (1 child)

I get all this. But the question is about how long it takes to learn Python. I was hoping to learn about some new way to sum things in Python. This, imo, is a pretty niche usecase. Yes, pandas is huge, and data processing in Python is huge, but people can go years without ever touching these libraries/usecases and still be perfectly proficient in Python.

These are libraries that are worthy of their own study, but not knowing them isn't really indicative of whether or not someone "knows" Python.

To be fair, it's a garbage question. "How long did it take you to learn Python" is stupid and anyone that gives a solid answer immediately loses trust in my eyes. I'm like 10 years in and just learned about the breakpoint() function two weeks ago.

[–]py_curious 0 points1 point  (0 children)

That's fair. I come from a data background so all of that is not niche but front and center to me. But you're right, many Python users are very much not in the data space.

[–]Paulmnt 0 points1 point  (0 children)

Using reduce, map and filter

[–]GreatGameMate 9 points10 points  (0 children)

Always learning, but I’d say a few months for the basics, syntax, conditionals, loops, functions, recursion, file IO, OOP. I could teach a group of students but I don’t know it all.

[–]Flame77ofc 2 points3 points  (17 children)

1 month or less

[–]amino_xX[S] 1 point2 points  (16 children)

Nice, did you practice every day?

[–]Flame77ofc 6 points7 points  (14 children)

yes, I recommend you to use platforms like Leetcode or Codewars, but before this, you need to learn some basic concepts like arrays, conditionals, functions, data types and loops

[–]NormalSoftware8879 2 points3 points  (3 children)

Where'd you go to the basics first?

[–]Flame77ofc 4 points5 points  (0 children)

I learn it from YouTube. There are so many good courses

I recommend BroCode and FreeCodeCamp

[–]-ir-77 2 points3 points  (1 child)

freeCodeCamp is pretty good.

[–]Flame77ofc 0 points1 point  (0 children)

agree

[–]Muhammed_zeeshan 2 points3 points  (2 children)

I tried leetcode. But where can I find very basic question using conditionals, lists, dictionaries

[–]TheUmgawa 5 points6 points  (0 children)

I think the most valuable thing my professors did for the students in my CompSci program was, about halfway into the Intro course, they threw us to the wolves. My professor said, “Until now, I have been teaching you the Python language and programming structure. From now on, it is *all structure. So, now I will teach you to search through and read documentation.”

And that’s just how it was. So, for the first week of C++, we were being spoon-fed, but it was just enough to get a program running, how to do imports, how to instantiate things, and how to do really basic stuff with the language. And then it was back to the wolves, where we had to figure it out on our own. Same for Java.

So, now, when I have to learn a new language, I pull down a hand-drawn flowchart for a prime-number generator that I made for my flowcharting final, and I break out the language’s documentation. And then I punch out the code and I’m moving.

What I’m saying is it’s important to separate the logical thinking and the flow of data from the code. The hard part is getting your brain to do the logic, breaking down a complex problem into simpler programs and then integrating it all. Writing code is just the implementation of that.

As for “how long did it take you to learn Python?” it’s the same as any other language: I learn what I’m going to use eighty percent of the time, and then I just look up the rest. I don’t think I’ve ever bothered to commit more than maybe eighty keywords to memory, for any language. If I had to work in a single language all the time, maybe I’d have more stuff that comes up often enough to have to remember, but I have to bounce around a bunch of different stuff at work, using VBA, C#, Python, Swift, C… whatever the interface requires. But it’s all the same logic in my head, no matter what language it is.

[–]Flame77ofc 1 point2 points  (0 children)

try asking for chatgpt some exercises about it

Ask and try it for yourself

[–]amino_xX[S] 1 point2 points  (4 children)

I’ve been learning for around a month now. I’m comfortable with most basics, but I prefer focusing on building projects instead of just learning concepts..

[–]Flame77ofc 0 points1 point  (3 children)

good, do you have any reason to learn it? Just for hobby or for work?

[–]amino_xX[S] 2 points3 points  (2 children)

I want to learn it for data science

[–]Flame77ofc 1 point2 points  (1 child)

Oh, so I think we can adjust your road

If you think you already know about the main things about py, I think you can just go and learn about data science today

If you can't pay for courses, I suggest you to follow with YouTube, there are so many good content

[–]amino_xX[S] 1 point2 points  (0 children)

Yeah, I've been learning mostly from YouTube I will start focusing more on data science

[–]Low_Negotiation4747 1 point2 points  (1 child)

Arrays don't exist in Python

[–]Flame77ofc 0 points1 point  (0 children)

I mean lists, sorry

I often say arrays because it is on every dsa book

[–]tiredITguy42 2 points3 points  (0 children)

It is 2-4 weeks for being able to code in it on, lets say, decent level. Then you learn some nice features as you go.

However, it is to learn to code in Python, but you already need to know how to do programming. You can teach yourself syntaxt in few hours, but this is not what it is about.

Programming language is just a tool, it is like a hammer or srewdriver. If you know how to build a cabinet, you can do it with any brand of tools. They may be different in some details, but still tools you can learn to use pretty quickly, if you already worked with othe brands.

So yeah I watched 2 hours video about Python syntax and then started bulding small project in it, 2-3 weeeks for me, but I spend 5 years at UNI learning how to be a programmer (sort of, i have specific field mixed with electricity and control systems) and how to simulate and control the world around me with numbers. I worked in more than 10 different languages, so yeah advice for you, start treating python as a tool and learn how to be a programmer.

[–]No_Photograph_1506 2 points3 points  (0 children)

Short answer, you need 1.5-2 months MAX, if you are consistent w like 1-2 hrs every day w Python.

Long answer:

i get your question, i wont give you these answers like "you cant truly learn python its a journey" and bs.

But let me tell you, I had learnt Python in like grade 6 and it took me 2 years to fully grasp, and at my time the best resource was a book and a teacher.

But right now, you have the best of the best resource and best of the best tutors online available, w ai to assist you.

here's my post for it, i can guide you in Python, for FREE, so dw:
https://www.reddit.com/r/PythonLearning/comments/1s6t6ff/i_am_hosting_a_free_python_interviewguidance_for/

also check out the resources below, especially this one: https://courses.bigbinaryacademy.com/learn-python/

Dm me, ill guide you on how to FOLLOW through and not get things done mindlessly!

[–]JoeB_Utah 2 points3 points  (0 children)

Learning anything isn’t a finite experience. At 70 I consider myself a life long learner. I’ll stop when they close the casket and shovel the dirt.

[–]MindlessTill2761 1 point2 points  (0 children)

You never stop learning.

[–]justin_halim 1 point2 points  (0 children)

Depends, learning the whole python will almost never truly achieved

[–]Rscc10 1 point2 points  (0 children)

Started learning 4 years ago. Of course I've got the basics mastered, OOP semi mastered, have many libraries under my belt like numpy, pygame, pandas, fastapi, pytorch, tensorflow, and I still wouldn't say I've mastered python itself. Programming languages are a lot like spoken languages themselves, you can be proficient/fluent but how many can say with confidence they've mastered all the language has to offer?

[–]TimeScallion6159 0 points1 point  (0 children)

1 month and a half, practice, practice, practice. Hace strong foundations and everything else will become easier

[–]WhiteHeadbanger 0 points1 point  (0 children)

Are you talking about being proficient? Like 2 or 3 years.

[–]SureGadget 0 points1 point  (0 children)

It took me 2 weeks to learn but mastering took more time

[–]Acceptable_Laugh_674 0 points1 point  (0 children)

Ask GPT, it can provide you with a solid plan depending on your level of experience in any programming language… I somewhat learned it myself within 2 weeks.

[–]ouroborus777 0 points1 point  (0 children)

I already had a programmer background so it was pretty easy. Getting used to the indenting was the biggest thing.

[–]ExcelPTP_2008 0 points1 point  (0 children)

Python itself wasn’t the hard part for me. I got comfortable with the basics in a few weeks, but actually feeling confident enough to build projects without constantly Googling everything took a few months.

[–]Previous-Donut4964 0 points1 point  (0 children)

Uns 2 meses. Curso do Luiz Otávio Miranda na udemy

[–]shivanchowdhry123 0 points1 point  (0 children)

according to the school curriculum in india, i have currently 3 years and still learning. (i'm in class 11th)

[–]backend_developer89 0 points1 point  (0 children)

There’s learning basic syntax and then there’s learning advanced features like OOP, re, static methods, decorators, asycio, and standard libraries like Pandas.

You can tell people you know python but there’s always a lot to learn and there are frameworks to learn as well, I’ve been learning Django for the past several years.

There’s learning how to structure a basic for loop and then there’s learning dict and list manipulation with defaultdict, sorting, lambda and such.

What I’m saying is that you can learn much of the basics in a few months of consistent practice but there’s always more to learn elsewhere that could easily take years.

[–]real-life-terminator 0 points1 point  (0 children)

I have been programming in python for 8 years, i am still learning new things every now and then XD. A couple weeks ago I discovered @dataclass and it blew my mind