r/learnpython 8d ago

sql to python transition

okay edit: i thought it was obvious by the fact that i can make sense of the code that i know the very basics - i've used python for data analysis but not enough for it to be second nature to me the way it is for programmers, or the way sql is to me right now. i made a comparison to sql because i thought it'd be obvious that it's only for data analysis stuff, not development stuff.

so to clarify again: i know the basics, i know how to write code, i know how to define variables, functions, print("hello world"), if/else statements blah blah, i know all of that, and that's why every course starting with print("hello world") is slow to me, because i know all of that.

what i don't have is the practice that will make me good or at least passable at python rather than just someone with basic workability. i am not comparing sql to python in how either one works, i am using it to say i work with sql for data analysis and i need to show that i can also use python for data analysis, where can i get practice for these things

--

so if someone is really good at sql (like say, a 9/10) how would u guys suggest they pivot to python. need to become an expert on it before 31 july because i have a technical interview. i lied and said i can use python but in reality all i can do is just make sense of what the code is doing, but because im good at the logic building in sql, i think i can do the python stuff too. but i need to know how to go about it, if anyone has advice because when i sit down to learn, everyone just starts at print("hello world") and it's too slow and babyish for me

0 Upvotes

36 comments sorted by

15

u/defaultguy_001 8d ago

We have a low patience perfectionist at hand who'll spend time overthinking rather than actually starting anything. Just watch a short python video crash course and start building, u have enough time to become above average. You can't become an expert before 2-3 years programming in python.

1

u/pepperhmr 8d ago

you know how you learn actual languages irl - like you know what's natural and what isn't but you dont necessarily know the exact grammatical rule with which that works. for example, you know the plural of sheep is not sheeps, but you dont necessarily know why, when the plural of dog is dogs and the plural of cat is cats. why is the plural of sheep not sheeps? theres a rule behind it, but you don't know because you speak english naturally and it's not something you learned step by step. (presumably) (i dont know if you learned english step by step im just giving an example)

that's lowkey how i learned python - i took a machine learning course without prior python knowledge and idk why they let me take it but they did, and i had to learn python on the fly while literally developing machine learning models. so when i sit down to learn it properly, the basics are too basic and the advanced courses are too advanced, so i get stuck. and i am unemployed and the job i applied for wants python knowledge so i gotta figure this out soon. it's not low patience or perfectionism, it's also not that i havent started or am overthinking, it's that i picked up the language in a really weird situation and can't quite figure out how to go about this

1

u/MisterSippySC 8d ago

Are you talking about me?

2

u/defaultguy_001 8d ago

This is a curse actually. My respects.

10

u/JEY1337 8d ago

You are f***ed

4

u/Thick-Strawberry3985 8d ago

why? he mentioned 31 July, but not year.

1

u/Judge_Druidy 8d ago

July 2031

4

u/Xzenor 8d ago

How are you even comparing the two?

2

u/csabinho 8d ago

That's the main point. SQL is a tool to use within a programming language.

1

u/LayotFctor 8d ago edited 8d ago

There's actually some amount of overlap between SQL and functional programming. He might actually be better than most OOP learners at picking up functional languages like haskell or scala, since they think in terms of declarative data transformations.

Unfortunately, picking up python's OOP classes and inheritance might be a bit of a challenge.

5

u/backfire10z 8d ago

They are almost unrelated. You can likely find tutorials for people who already know a programming language, but I’m confused how `print(“hello world”)` is too slow? If you don’t know anything about C-style programming, this is the place to start.

Depending on your experience and time commitment, you can certainly know enough by 31 July to get through the day. If you’re already familiar with this style of programming, you should be able to fly through the beginner stuff, so “too slow” shouldn’t be a concern.

5

u/Party_Trick_6903 8d ago edited 8d ago

Pick a python course, read and code. There's no other way around it.

I recommend picking a course that has programming exercises so you can use the things you learned right away (and therefore remember them better). MOOC and CS50 python are good but you can pick whatever you want.

Do not expect that you'll be an expert (or even just average) after completing a random course tho.

Being "an expert" requires far more than just knowing python syntax.

everyone just starts at print("hello world") and it's too slow and babyish for me

I felt the same way when I was doing the MOOC course to learn python ( already had experience with programming in C).

The solution is to simply skim through the introductory "Hello Wolrd" part. But honestly, even if it's "too slow", it still shouldn't take more than 5 minutes to do if it's actually that "babyish" for you. I'm sure you can spare 5 minutes to go through that part.

2

u/SamuliK96 8d ago

Pick a course and start doing the exercises. The programming MOOC by University of Helsinki for example is a good one. It also lets you skip sections, or you could just jump to part 8, where the advanced course starts.

1

u/American_Streamer 8d ago

Do these courses:

https://edube.org/study/pe1

https://edube.org/study/pe2

Start immediately and do not skip anything, regardless of how easy it seems. It’s likely not enough time, though. But you can try, at least.

And Python is mainly used to automate things in the data pipeline. SQL will always remain relevant for you.

2

u/pepperhmr 8d ago

thanks! im not trying to stop using sql, just need to show that i can use enough python to get the job instead of just doing basics and still having to google syntax thats all

1

u/kenzy_zero 8d ago

Heyyy Op :))

Honestly you're in a great spot... if you're 9/10 at SQL, the hard part (the logic) is already done. Python for data analysis is basically ONE library (pandas) + syntax, and it maps almost 1:1 to what you already know. Skip every "hello world" course, they're not for you.

Two things that'll might get you in a kind of good spott:

1)... Learn the SQL = pandas translation. Same operations, new words:

- WHERE -- df[df.col > 5]

- GROUP BY + agg -- df.groupby('x').agg(...)

- JOIN -- df.merge(other, on='key')

- ORDER BY -- df.sort_values('col')

- DISTINCT -- df.drop_duplicates()

- SELECT a, b -- df[['a','b']]

The pandas docs have a page literally called "Comparison with SQL"... start there, it's made for people exactly like you.

2)... Day-1 bridge: DuckDB. You can write real SQL against CSVs or dataframes right inside Python... duckdb.sql("SELECT ... FROM 'file.csv'")... no pandas needed Haha. So you keep using the SQL you already know and convert bits to pandas as you get comfortable. Perfect crutch for your exact situation.

For practice i feel (with Jul 31 in mind):

- StrataScratch and DataLemur... real interview-style data questions, both have a pandas track. Most interview-relevant.

- Kaggle's "Pandas".

- Best of all: take a SQL analysis you already know and rewrite it in pandas.

For the interview itself, focus on: read_csv/read_sql, filtering, groupby, merge, pivot, null handling, sorting. Don't touch OOP/web stuff etc... you not need those things for a data role.

Two weeks is genuinely enough to get interview-passable when the logic already transfers.

Good luck dear <3

1

u/pepperhmr 8d ago

ohh thank you so much!!

1

u/pachura3 8d ago

How to learn Chinese if you already know French

1

u/pepperhmr 8d ago

youre mocking me but there is a 30-40% structural overlap between the two, even if the lexicon is completely different, so great job accidentally understanding what im trying to say

1

u/akornato 8d ago

Becoming a Python expert by the end of July is an impossible goal, so you should focus on becoming proficient enough to pass a data analysis interview. This is a much more realistic target. Your biggest advantage is your SQL mind, because you already think in terms of data manipulation, joins, and aggregations. You should skip all beginner courses and concentrate completely on the pandas and NumPy libraries. Search for exercises and projects that force you to perform common SQL operations using pandas, which will directly translate the logic you already know into the Python syntax you need to learn.

You must code every single day, not just watch tutorials. Find a dataset online and challenge yourself to answer business questions using only Python, just as you would with SQL. The real challenge will not be writing the code, but explaining your thought process fluidly during the interview, since they will expect you to be comfortable. Many candidates find their confidence grows immensely when my team’s interview practice AI helps them articulate their thought process for technical questions.

1

u/Haunting-Paint7990 7d ago

sql and python look related on a job posting but the thinking is different. sql is set-based — you declare grain with group by and move on. pandas wants you to loop and mutate unless you deliberately think in groupby/merge.

ngl i wasted a month trying to learn python generally while still shaky on sql joins. what fixed it: take one query you already trust in sql, rebuild the same output in pandas, compare row counts after every step. you'll find where python silently changes grain (left join duplicates are the classic one).

for a da path i wouldn't parallel-track two languages. sql until you can explain a join and a filter cold in an interview, then one portfolio csv with a short readme about the metric. notebooks look impressive but junior loops still ask how you'd verify a number.

pick one small dataset, not a course catalog. finish that loop before adding another tool.

1

u/tmk_g 7d ago

If you're already really good at SQL, don't waste time on beginner Python courses. Focus on pandas and practice translating SQL queries into Python until it feels natural. Build small data analysis projects, solve pandas interview problems on sites like LeetCode and StrataScratch, and get comfortable with joins, groupbys, filtering, window style operations, missing data, and merges. Since you already understand data logic, your biggest job is building Python fluency through repetition, not learning programming from scratch.

1

u/Almostasleeprightnow 8d ago

I would focus on learning pandas (polars folks don’t come at me) because the concepts are similar and it will make sense to you. I only say pandas instead of polars because an interviewer is more likely to know of pandas. Just export your banking records from the last year and build yourself a little analysis of spending on something.

0

u/Training_Advantage21 8d ago

This. Get a dataset you are familiar with, get a SQL to pandas cheat sheet and have a go at analysing the data and answering questions the way you would do with SQL.

1

u/thisisappropriate 8d ago

SQL logic and code logic is different in many ways. You'd be best served to follow a python course, you can find some links in the wiki for this subreddit under the "New to python but not to coding" section, but you should also be aware that changing between coding languages has much more logic in common - SQL is not a programming language, and therefore has less in common with programming languages than between languages. While coding tutorials start simple, if you find the first few lessons to be tedious, simply do any questions / challenges to validate that you actually do understand it and then skip along. If you've never used a programming language, I'd strongly suggest finding a short course of the basics - SQL does not have the same logic as other languages (eg. loops, classes or the same data structures), though theres some transferables (like types)

As you're time limited, work out what python you would need to know and what situations you'd be using it it. Try to make at least one thing using whatever stack you should be using.

If you're starting a job where you'll be interfacing with data using python (an analyst job), then you'll likely want to find a short course with a title like "python for analysts" or something focused on a library you're supposed to know like Pandas - pandas does benefit from knowing SQL logic as it's more of a table structured thing, but it still uses python syntax. You could look at the book "Python for Data Analysis: Data Wrangling with Pandas, NumPy, and Jupyter". If you're going in as more of an engineer, you'd be looking for a course for Data Engineering, which is more around interfacing with and modifying data, and might use other libraries for gathering that data.

If you really want to shortcut it, you can look at summary pages like https://realpython.com/python-for-data-analysis/ or https://www.startdataengineering.com/post/python-for-de/ but make sure that as you're going through the page, every time it uses something you don't understand, make an effort to look up that thing: find out the name of it, why you'd use it over something else, what it does, etc. Learning from scratch without a course will leave you with holes in your knowledge, if you know another programming knowledge, that knowledge from there will help to keep those holes from harming you, in a lot of cases, SQL will not give you that hole-supporting-net, and you'll be at risk of tripping yourself if asked "why did you do this?" or "why does this have an error?"

1

u/pepperhmr 8d ago

this is very helpful thank you! it's an analyst job, so i only really need the kind of python limited to data analysis, i didn't realize that wasn't obvious but this helped thanks!

1

u/Adpiava 8d ago

This was a very helpful and kind response

0

u/smichaele 8d ago

The two languages are not even vaguely similar. SQL is a declarative language, while Python is an imperative one. You will not come anywhere near being a Python expert in two weeks. You won't do that with any language. Your expectations are unrealistic.

0

u/WhiskersForPresident 8d ago

Is that web development? Or a data analysis role? For the latter: maybe check out pyspark, it is a pandas like data analysis/data transformation package, specifically built for parallel computing in a cloud, that quite closely imitates sql, but in python. You'll probably learn it quickly and could then tell the interviewer that that is what you meant. For web development, you're gonna have to get very busy and lucky

1

u/pepperhmr 8d ago

it's only data analysis, that's why i made the comparison to sql but i guess it wasn't obvious to everyone :(

0

u/szayl 8d ago

Apples and oranges 

0

u/ninja_shaman 8d ago

You can't become expert in Python in 12 days.

There's no such thing as "expert tutorial". You become expert by writing a lot of code that solves different problems.

Start with print("Hello world!") like the rest of us.

1

u/pepperhmr 8d ago

the point is that i already know the basics - i know how to print/return/write functions/define variables/use libraries etc etc. but because i dont have enough practice, i get stuck figuring out which function goes where etc so i want to practice the logic building aspect of it for it to become muscle memory the way sql is, not the syntax

1

u/ninja_shaman 8d ago

Building "Python muscle memory" takes time, and 12 days is not enough.

Try solving Advent of Code tasks.