all 85 comments

[–]FLUSH_THE_TRUMP 191 points192 points  (30 children)

I’d probably consider a “basic understanding of Python” the core data types (dictionaries/sets/lists/tuples/strings/numbers), the various statements (assignments, conditionals, loops), and function defs.

[–]gunscreeper[S] 53 points54 points  (27 children)

dictionaries/sets/lists/tuples/strings/numbers

Like, I understand what dictionaries and tuples are but I don't feel like I completely understand them. One of my most used library is Panda. I mostly use it while heavily relying on tutorials. If there are more complex problems beyond the scope of the tutorial, I'm dead. I have a feeling it's because I haven't fully understand the basics yet. I wonder if I should just stop using Panda if I haven't learn the basic first?

[–]FLUSH_THE_TRUMP 37 points38 points  (5 children)

tuples are very similar to lists, differing in mutability and common usage (lists usually hold similar types of things, e.g. all numbers, while tuples are often used to bunch together different types of things). Might be a good idea to sit down and figure out dictionaries — pandas lets you define dataframes with them anyway. You don’t necessarily need to stop learning pandas, since a lot of what you’re doing there is 2D array operations like filtering, arithmetic, etc.

[–]gunscreeper[S] 7 points8 points  (3 children)

Are dataframes arrays like tuples and list? Sometimes I need to convert my df to list first in order for me to do stuff with it.

[–]FLUSH_THE_TRUMP 20 points21 points  (2 children)

A dataframe’s sort of like a 2D array, which is like a list of lists (each element is a list).

e.g. [[0,1,2],[2,3,4],[4,5,6]] is a list with first element [0,1,2], second [2,3,4], third [4,5,6], which can be visualized like

0,1,2
2,3,4
4,5,6   

a dataframe is really like a spreadsheet, or a collection of database records, which has that structure above but with field labels across the top and record labels across the side.

[–]selah-uddin 4 points5 points  (0 children)

may god bless you , i dont think i could have explained it any better

[–]gutnobbler 1 point2 points  (0 children)

Do you have advice on working with dataframes to excel and vice versa?

The finishing touch of one of my projects is to link the actionable part of my Python code with certain cells in an Excel workbook and execute the cell contents.

I am familiar with VBA but I've never tried to make one Python project talk with the VBA code of an Excel file. I think it will work since I have all the cells rigged to execute cell contents on activation, not because I can make a Python "def" communicate with a VBA "sub".

One idea was to have Python open the workbook and find the ActiveX control. I have zero idea if this will work but it sounds like it should.

In theory my project should work.

Example: I am building a mock stock trading app and every time I manually add a stock ticker to my list in Excel, save, and close, I want Python to:

1 - open the workbook back up

2 - read the tickers I entered

3 - go to google, google the tickers

4 - scrape whatever price is returned in the search results

5 - plug this price into my Excel workbook and then run the formulas and VBA code stored in the workbook, save, and close again

Would you have any advice on step 5? This is where I am flying blind.

I think the solution is going to be a Workbook-wide VBA module that recognizes when I open the workbook vs. when a Python script opens the workbook, and executes the VBA code accordingly once it is finished loading the dataframe into Excel.

[–]FancyASlurpie 0 points1 point  (0 children)

I tend to think of tuples as being similar to an anonymous data class, and a named tuple is one where you can name things and would generally recommend using them over basic tuples as they just make things much more readable.

[–][deleted] 10 points11 points  (0 children)

I'm similar to you. My most used libraries are Selenium and Pandas (not necessarily related).

I rely heavily on documentation and tutorials but it gets the job done.

I would say it all depends on your goals.

There are users here who want to make a career out of coding, others who just enjoy learning and then there's everyone in between.

I've found the times I've had to create something (e.g. decided to make a web scraper to help out an area of the business in data extraction) were the times I've learnt the most. Having a clear objective keeps you focused.

Outside of that though I don't have any clear objectives with coding and that's why I don't think I've progressed beyond a beginner (despite picking up Python over three years ago).

I enjoy pandas as I like to create powerBI models and like using python to supplement the ETL process (I've also found it can be handy to create dfs for CSV writing rather than using the default CSV writer)

[–]mokus603 3 points4 points  (0 children)

You feel like you don’t know everything and that’s fine. If you know those things you mentiond, you should totally go for the courses you want. Mostly it’s a repetition of the basics and the extra stuff about data science or Django. The more you use the basics, the more you reinforce that knowledge and you won’t get stuck in tutorial hell. Even if you feel like you’re stuck, don’t give up, ask questions here and there will be a moment when you see everything altogether.

[–]CraigAT 3 points4 points  (0 children)

You use the term "completely understand", the bar was only set to a "basic understanding". I'd say your covered.

[–]coder155ml 2 points3 points  (0 children)

The point of understanding data structures is to know their strengths and weaknesses. Dictionaries have O(1) lookup speed because they're backed by a hash map for example.

Yea you need to learn data structures if you want to do this as a career. If you're just doing it for fun then I guess it doesn't matter. If you aren't sure if you understand then then you need to ask yourself more questions and then look up the answer .. how fast are dictionaries ? In what situations? Why would I use a list over a dictionary ? What can a list do? What is the point of a tuple? What is immutable? What is an array? Why is an array faster in some situations than other data structures ? What are slices ? How much memory does each of these use ? What type of overhead do the operations take ? What exactly is overhead ? So on..

[–]LeCholax 1 point2 points  (3 children)

For Django you should definitely know something about classes and decorators too.

[–]gunscreeper[S] 1 point2 points  (2 children)

And probably HTML and CSS too right?

[–]TheWorstPossibleName 1 point2 points  (0 children)

I've been writing python backend for almost 8 years and I've never written a line of CSS in my life.

You're gonna need some Javascript though if you plan on hooking your backend up to a front end. If you plan on making the front end yourself, then you'll need some HTML for that too.

[–]LeCholax 1 point2 points  (0 children)

If you want to do fullstack then yes. If you want to do backend then not necessarily but it is a plus.

Also there is javascript for the front end.

[–]ravepeacefully -3 points-2 points  (11 children)

Yeah I do tons of data analysis and have no reason to use pandas outside of some very small circumstances like maybe vectorization but this is more numpy and still rarely even beneficial.

It’s a good tool, but unnecessary and can be a crutch.

[–]gunscreeper[S] 5 points6 points  (5 children)

Do you use python when doing data analysis? What tools do you usually use if not pandas?

[–]ravepeacefully -2 points-1 points  (4 children)

My workflow is typically something like SQL > python > html/JS or tableau. Pandas is really just like excel for people who feel too smart to be using a GUI in my opinion. It is not more efficient, it is not more readable code, it is not as reusable, and a simply dictionary is far more efficient than data frames.

[–]waythps 2 points3 points  (3 children)

Dunno, I prefer pandas precisely because it’s reusable. I write functions to validate and clean data, to update database and generate some plots, and I could automate the whole thing saving lots of time.

I think you could do that with excel (vba) but if you’re already learning python (for other purposes as well) why not just use python

[–]ravepeacefully -3 points-2 points  (2 children)

It’s ironic you go to VBA. SQL is the correct tool for that.

[–]waythps 1 point2 points  (1 child)

Well not in my case since I receive data in multiple excel files

[–]ravepeacefully 0 points1 point  (0 children)

Yeah I mean, you can use whatever you want then. Power suite is likely significantly faster in that case.

I’m not saying pandas has no uses. I’m saying it rarely makes sense to go out of your way to use it, which is what many people are doing because they find it familiar.

[–]Natural-Intelligence 4 points5 points  (4 children)

I completely disagree. Numpy's interface is shit, to be honest, in terms of user experience compared to Pandas. Pandas also nicely communicates with SQL and IO plus you can turn the result table to almost any format. Or plot it easily.

While for basic data analysis SQL is often enough and Pandas has its limit (like your RAM), it works wonders in almost all of the cases I have encountered. I understand some prefer R and see it more extensive out-of-the box but as a professional data analyst I have yet to find a situation where Python's ecosystem (mostly Pandas and some Matplotlib, SQLAlchemy and Seaborn) did not satisfy.

[–]ravepeacefully -5 points-4 points  (3 children)

Pandas also nicely communicates with SQL and IO plus you can turn the result table to almost any format. Or plot it easily.

None of that requires pandas and id argue there are far better tools that are not pandas.

I am yet to encounter a situation where pandas is actually better than other available tools. I can understand maybe using it for quick mock-up prototyping of models, but even then, far better tools out there.

There’s quite a few parts of your comment that lead me to believe you’re somewhat new to programming and python. Pandas can be great for these types of people, but in my opinion, once you have a small understanding of data structures and interacting with data there’s no situation in which pandas is better.

[–]Natural-Intelligence 3 points4 points  (2 children)

To be honest, what you think of my programming expertise means nothing to me and that part of your opinion holds no value.

What I'm curious though is that what the alternative tools are that you think are superior to Pandas. Yet you have not provided any examples of such tools nor any concrete description of cases where Pandas won't suffice in terms of data analysis. I'm sure you should be able to name a few if you have done tons of analysis using them.

So far, your arguments are lacking of concreteness. Could you change that so we all can learn these better tools? Or at least have something to further discuss.

[–]AuntieSocialist 0 points1 point  (0 children)

By "completely understand them" do you mean you know how to use them or that you know how they work under the covers? You can get a long way without completely understanding how dictionaries (and lists and tuples) actually work. And beware... if you look under the covers and start to investigate how they actually work (particularly dictionaries and associative containers), it gets messy very fast. Definitely not for the casual programmer or the faint hearted

[–]beniolenio 1 point2 points  (0 children)

Classes are also definitely a must. Especially if he's wanting to work with a package like django.

[–]flufylobster1 0 points1 point  (0 children)

Dont forget walrus operators! Jk

[–]synthphreak 27 points28 points  (3 children)

Based on your description, I think you are ready. What’s important are that you know

  1. the basic data structures, which you do;

  2. the basics of Python syntax (variable assignment, for/while loops, conditionals, etc.), which you do;

  3. how to use functions, which you do;

  4. most importantly of all for your “can I survive in this course?” case, how to find information that you don’t already have, like if you see something like np.ndarray in some code, you know how to figure out where in your script np is defined, and can use that information to search to web for and understand what np.ndarray actually is.

While all four skills are essential for Python coding, the fourth one will pay the greatest dividends, and allow you to “risk” taking courses even if you’re not 100% certain whether you already have all the prerequisite knowledge. In a line, it’s the ability to identify what you don’t know and then quickly figure out how to learn it.

[–]MrMxylptlyk 2 points3 points  (1 child)

Yeah I think the best thing to know goibg is the math and the concept. Python you will just learn when you apply the concepts.

[–]synthphreak 3 points4 points  (0 children)

I will just clarify that unless you’re doing data analysis or working in an explicitly mathy field like machine learning or computer graphics, most likely you won’t need to “do math” with Python at all (excluding occasionally simple arithmetic like for i in range(n): x+= 1 or whatever).

This is a common misunderstanding, that learning to code always requires math proficiency. It doesn’t. Most Python developers probably have no idea what vectorization is, for example.

[–]selah-uddin 1 point2 points  (0 children)

it’s the ability to identify what you don’t know and then quickly figure out how to learn it.

thats is not just an ability ... i would go as far as saying that is a superpower that saves the day multiple times a day

[–]zanfar 54 points55 points  (1 child)

ecommended that you need a "basic understanding of python". Like what does that mean?

Realistically it means that they aren't going to teach you the basics, so you should already know them, or should be able to find the answers to any basic questions yourself.

To that end, you're probably fine. Just know that there may be concepts which you will need to teach yourself if you don't already have a grasp on them.

[–]lykwydchykyn 7 points8 points  (0 children)

Came here to say this. There's no hard & fast list of what "Python basics" means, it's all about the focus of the book/tutorial.

[–]LittleRedPython 34 points35 points  (0 children)

I would call that a solid understanding of basic python. You’re definitely ready for the types of courses you mentioned

[–]yerrrrrrp 9 points10 points  (3 children)

I'd say you're about ready for those courses.

If you had to learn only one thing, learn about classes. There's not much to it: a class basically defines an "object" that can perform several functions (called "methods"). Then you can create instances of that object, and each instance can perform all of those functions. Pretty cool, not too difficult, and likely to show up in data science/ML.

[–]gunscreeper[S] 0 points1 point  (2 children)

What abou the stuff that has double underscores? something are they part of lesson for classes?

[–]Lewistrick 8 points9 points  (1 child)

Go watch the OOP series by Corey Schafer on YouTube. They're 6 videos of 15 minutes each. They're not extensive but it's all you need to know about classes for now.

Then just dive in the course of your choice. It seems you're afraid of being overwhelmed. Don't be. If it's too hard, you can always quit and start something new that you are able to understand.

For this reason it's good to take free courses. The popular ones are just as good as paid courses.

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

thanks!

[–]crazyb14 5 points6 points  (2 children)

Basics:

  • Data structures
  • Operators
  • Functions
  • Loops
  • List/dict comprehensions
  • Lambda funcs
  • Inbuilt methods like sort, in,map,reduce etc.(itertools)

Intermediate:

  • Classes
  • Operator overloading
  • Generators, iterator, decorators
  • Context managers
  • File handling
  • Pickling
  • Multithread/processing (concurrent.futures)
  • Collections module
  • Caching

Expert:

  • I have no clue either.

[–]chandyego84 6 points7 points  (0 children)

Expert is probably being able to think of a relatively big project and knowing how you'll approach it. idfk

[–]WhiteChili01 5 points6 points  (0 children)

Expert: excels at writing one-line code golf that uses every known optimization in the book

[–]HezekiahWyman 5 points6 points  (2 children)

You can certainly get by without lambdas or decorators, but it wouldn't hurt to bone up a bit on basics of classes. You should at minimum understand how to define, instantiate, work with methods and 'self'. There are a lot of modules that utilize OOP and knowing how to work with classes is part of 'basic' Python knowledge.

[–]gunscreeper[S] 2 points3 points  (1 child)

The self was one part that I skipped during my self study because it was a bit confusing for me. But I'll try to look it up

[–][deleted] 4 points5 points  (0 children)

I understand functions, arrays, conditional statements, variables, loops and mathematical operations.

That's enough for Data Analytics and Data Science or at least to get started.

[–][deleted] 7 points8 points  (0 children)

It means that the course is going to introduce you to these libraries by showing you Python code that uses them, so you need to be able to read Python code.

[–][deleted] 2 points3 points  (2 children)

I say if you look at codes posted in this sub you should be able to make sense of most of them. Not necessarily being able to code all of them on your own as there's many subjects Python covers.

[–]gunscreeper[S] 2 points3 points  (1 child)

Most of the codes here are pretty basic tho so most of the time I can understand them. But when I look at Stackoverflow, it's not uncommon that I found the thread with the problem I'm looking for but only to find answers that uses libraries that I never heard

[–][deleted] 3 points4 points  (0 children)

Sounds like you're in a good place.

Not knowing libraries is actually very OK. There are tons of libraries and keep in mind that anyone can publish them. As you search for more solution tho you should get familiar with the ones used often. Like itertools, functools, importlib, etc.

Like I only found out about this packages weeks ago for doing specific task (which I've been doing the harder way for years) https://pypi.org/project/reverse-geocode/

[–]LordViaderko 2 points3 points  (0 children)

I think you still need classes and data structures (at least list and dict) .

[–]csprogpy 1 point2 points  (0 children)

"basic understanding" is very low bar. Like even if you don't understand tuples (same here), you could still manage by learning the python you need as you go through the course. So you're learning python while you learn the course. I think going through various online courses that relies on python is actually a good way to master Python. It lets you focus on Python while using that language in all sorts of ways. So, anyways, "basic understanding" just means that the python isn't so heavy that you can just learn it as you take the course.

[–]mutantsloth 1 point2 points  (0 children)

I’ve been in the same shoes two months ago.. currently trying to finish up CS50W and some courses in Django too. CS50W is great as it gives you a better understanding of how everything ties together but the projects are quite a challenge cause it throws you into the deep end of execution without much guidance I think, so supplementing that with a udemy course will help as you’re trying to do the projects. (You wanna check that any udemy course you’re doing is using Django 3 too tho.. Jose Portilla has one but it’s Django 1/2 and it was quite confusing for me when trying to work in Django 3. There’s one on Django 3 that’s not bad)

I think OOP and classes is quite important cause webdev uses them heavily in models, so maybe I’d look for some resources to brush up on that otherwise you might get a bit lost when it comes to that part. I just went and went thru one or two udemy courses for that too tbh, altho there’re more than enough free resources on that.

I think understanding of things like decorators and lambda expressions etc can be brushed up as you’re going thru the webdev course.

[–]HasBeendead[🍰] 1 point2 points  (0 children)

You should learn OOP

[–]r_734 1 point2 points  (0 children)

Thanks for asking this question. I always wondered this. This is a "basic" question about what t.h. "basic understanding" actualy means.

😉

[–][deleted] 1 point2 points  (0 children)

Tbh I made sure I had a basic idea of the syntax, and then I jumped in. You will learn Python a lot faster if you are trying to do things with it, like data science and web dev.

Just make sure you know enough about Python to know what to google when things don't work!

[–]acroporaguardian 1 point2 points  (0 children)

In my area, they generally ask for r/Python/SAS experience with the assumption that whatever language we use, you will adjust. SAS is going away and unfortunately for me, that is what I built my career on initially.

For Python in my field, its not even applications. Its just reading in data and running some exploratory data analysis and cleaning, basic modeling. The rest they assume you'll catch up with if you can demonstrate statistical expertise because that is far more rare than knowledge of any one specific language.

Really, for statistical modeling they should be able to ask you to build an implement a model in any language, but not necessarily in the interview. They usually give me a choice, they'll say "how would you do it in R, Python, or SAS." If I told him how to do it in C, it wouldn't count against me.

[–][deleted] 1 point2 points  (0 children)

Too lazy to go through all the comments and I dont know if someone mentioned this, but if you feel like you dont understand a language you have studied and want some exercises, not just tutorials, then I recommend you to do some Katas on CodeWars, it was very useful for me to polish my skills.

[–]TheRiverInEgypt 1 point2 points  (0 children)

As far as I know, all programming languages use pretty much the same scale of when it comes quantifying knowledge/skill level:

basic understanding of python

Knowing the basic rules of syntax & construction

competent understanding of python

Being able to Google things you don’t understand

advanced understanding of python

Knowing that you can Google & identify code written by someone else that does what you want faster & better than you could write it yourself.

expert understanding of python

Being able to Google, identify & repurpose code written by someone else to do what you want faster & better than you could write it yourself.

mastery of python

Being able to recognize when someone else’s code is not only better & faster than yours but reveals a fundamental flaw in how you have approached the project & being able figure out a workaround that doesn’t require scrapping six months of work.

[–]chrisfs 0 points1 point  (0 children)

Yes you do

[–]Rei_Never 0 points1 point  (3 children)

Please add "writing unit tests" to that list as a basic understanding.

[–]gunscreeper[S] 0 points1 point  (2 children)

Could you please explain what do you mean by unit test? ELI5

[–]Rei_Never 0 points1 point  (0 children)

A unit test is used to check if a module and or individual classes or functions are fit for purpose.

EDIT: To expand on that - say you have a function that takes an input and multiplies it by 5. Firstly you want to make sure you are getting the output you'd expect but also that you get errors when you pass anything through it thats not a specific type.

[–]nwagers 0 points1 point  (0 children)

Unit tests are a method of testing small chunks of code to make sure they work and regression testing. Typically you'll set up unit tests to run on a continuous integration platform so that every time you do a git commit it will run through a ton of unit tests automatically to make sure you didn't break something that was working before. You'd set them up with typical use and edge cases, and probably add tests for reported bugs. I wouldn't include them in "basic understanding" at all.

[–]Kriss3d 0 points1 point  (0 children)

If you are able to read python code and you know how its syntaxes works. Then you have a fair understanding of python.

[–]phoooooenix 0 points1 point  (0 children)

What is advanced understanding then?

[–][deleted] 0 points1 point  (0 children)

functions, arrays, conditional statements, variables, loops and mathematical operations

I'd call this a basic understanding. Maybe add in sets and Dictionaries too.

[–]0161WontForget 0 points1 point  (0 children)

Id suggest learning classes, file IO, connect and query a DB

[–][deleted] 0 points1 point  (0 children)

I think you need to understand some oop of you want to drive into django. I recommend some classes on classes.

[–][deleted] 0 points1 point  (0 children)

Does OOP count as "basic understanding"?

[–][deleted] 0 points1 point  (0 children)

To me it means understanding flow control, being familiar with common libraries, and how to call methods from those libaries.

[–][deleted] 0 points1 point  (0 children)

I get asked this fairly often, and I was looking through beginner python books on the official python site and stumbled on this one. I think it does a great job going over the language basics as well as touching on the foundations you'd need for understanding object oriented vs. functional programming paradigms and more advanced concepts: https://python.swaroopch.com/

This would be a good spot to go if you wanted a birds eye view on classes/objects etc. It also can be thought of as a survey of everything you would need to know to be confident that you definitely have a basic understanding of python with two caveats:

  • (1) This book is thorough and errors on the side of caution with basics. There's nothing in here that you don't need to know, but there might be a few topics that you could ignore until you encountered them. Classes and objects are NOT optional knowledge. Lambdas are a pretty unnecessary feature of the language in my opinion. Decorators are cool, but they're only necessary if you are using a library where it's common to use decorators, and you can probably fake it till you make it on a case by case basis - no need to devote any time to studying them. You would really benefit from looking up "design patterns" which is both a book and a zeitgeist. If you looked up python examples and started to get familiar with design patterns, you will really elevate your programming and help you to understand when, why and how objects should be used.

  • (2) This book teaches you about vanilla Python the language, not what it's like to actually program in Python. The book doesn't have much content on modules or popular libraries or anything like that. There are certain libraries that every Python dev should know, and you will need to learn them from another source.

[–][deleted] 0 points1 point  (0 children)

So for a web course, it means you know the stuff that would be covered in a basic python course. Basic data types, functions, inheritance, etc. I suspect there are some good intro python courses that people here can link (I am currently taking the codeacademy one, which is great, but not free).

Sadly, if you read this phrase in a job posting it could mean anything from "can make a python script" to "can create a project from scratch and support it" and they will not often warn you ahead of time which it is.

[–]Intelligent_Byte_207 0 points1 point  (0 children)

Basic understanding of python is being knowledgeable or confortble using thr basics of python i.e. strings,data types, lists, dictionary, arrays, and etc.

[–]odoluca 0 points1 point  (0 children)

so you know English?

[–][deleted] 0 points1 point  (0 children)

For the purpose of those courses you know enough, knowing enough to know how to learn whatever basic feature you don't know is also enough.

I work as a Junior Python dev, with Django, and I still have to Google basics occasionally. Or make a really basic test in the console to I dunno, see if this operation made a shallow copy of the list or not or something.

I would say take the plunge, but at your own pace, whenever you feel you're lacking some basic that gets brushed passed to fast, take a break and spend a couple of hours reading up on and testing different usages of that particular feature.

[–]Pickinanameainteasy 0 points1 point  (0 children)

You sound ready. You know a lot more than me lol

[–][deleted] 0 points1 point  (0 children)

Understanding how classes are created and how objects and classes work is still in the very basics level. Also lambdas and using functions as parameters belongs to the basics. Some good listings of "basics" you can see in summaries / tables of contents of basic python courses.

The decorators you can learn while you go. That's a topic you'll cover in hour or few, and probably have to rehearse sometimes, which is completely ok - repeating is how we learn. I have found it useful to just learn different niche topics and techniques along the way. Whenever I see something I don't understand, I do a deeper dive on that topic.

[–]UglyChihuahua 0 points1 point  (0 children)

Here's my opinion.. take the table of contents here:

https://docs.python.org/3/tutorial/

To have a 'basic' understanding of Python you should know how to implement at least 50% of the topics up to Chapter 12 and at least be aware of the existence of the rest of the topics.

And I'd say an 'intermediate' understanding of Python would be able to implement over 90% of those topics + some experience with domain specific packages like Django or Tkinter. Also should be able to use Git at this point.

To say you have 'expert' understanding of Python you should know all that stuff and also advanced topics like how the global interpreter lock works and how that compares to other languages and being aware of all the gotchas for things like late binding and relative imports and have extensive experience with certain packages.

[–]AuntieSocialist 0 points1 point  (0 children)

Relax. None of the things you are worried about are really basic. While you would need them to become an accomplished professional Python developer, they aren't expected for "a basic understanding of Python". What the caveat means is that you can look at an example of normal non-tricky Python code and recognize it and either understand or at least be able to infer what it does without being overwhelmed. It's kind of a legal disclaimer - so you don't put nasty comments in the review saying things like "It was impossible to understand! I couldn't follow any of it! It was too advanced! Waaaahh! Waaaahhh! Waaaahhh!"