I need to work with some data and struggling to think today.
I have a list of assignments in a SQL table. I have a separate table with scores for each assignment (linked to a user account). I need to turn this into a table of users and assignments.
My thought right now is to create a list of assignments and use that to create a collection of OrderedDicts with keys entered in the same order as the assignments list. Then I can iterate into table rows. Or is there a better method?
Tomorrow's free LIVE session covers how to structure real Python projects using these patterns.
#Python #CleanCode #SoftwareEngineering #ABCs
Apply different aggregations to each column when grouping on a #Python #Pandas data frame with agg and a dict:
(
df
.groupby('VendorID')
[['trip_distance', 'total_amount']]
.agg({'trip_distance':['median', 'std'],
'total_amount':'mean'})
)

Newly public screencast on the lexicographical ordering of tuples in Python.
Python Tip: Walrus Operator :=
# Assign AND test in one line
if (n := len(data)) > 10:
print(f'Too long: {n}')
The walrus operator (:=) assigns a value and returns it. Perfect for avoiding redundant...
https://raccoonette.gumroad.com/l/Python-for-Beginners-From-Zero-to-Your-First-Projects
#Python #CodingTips #Programming
Python Tip: match/case (Structural Pattern Matching)
match command.split():
case ['go', direction]:
move(direction)
case ['pick', 'up', item]:
grab(item)
case _:
print('Unknown command')
Python 3.10 match/case goes beyond switch statements. It destructures and binds variables.
https://raccoonette.gumroad.com/l/Python-for-Beginners-From-Zero-to-Your-First-Projects
#Python #CodingTips #Programming
[March, 4 , 2024]:
An old, but important post.
#Européens should take thos seriously
#WhiteHouse Warns Against Using #Memory-Unsafe #programming #Languages
Should we teach #Rust instead of #Python ? I would quite agree.. with this point of vue..
#education #cyber
thenewstack.io/white-house-...
White House Warns Against Usin...
[March, 4 , 2024]:
An old, but important post.
#Européens should take thos seriously
#WhiteHouse Warns Against Using #Memory-Unsafe #programming #Languages
Should we teach #Rust instead of #Python ? I would quite agree.. with this point of vue..
https://thenewstack.io/white-house-warns-against-using-memory-unsafe-languages/
Aaand we're seeing the first '#setuptools < 82' runtime dependencies in random packages because they are trying hard to workaround breakage due to pkg_resources removal.
More work on my pure #python #rpn #calculator. I added the ability to edit user functions for the calculator with syntax highlighting thanks to the IDLE editor.
https://github.com/dnparadice/PyCalc

Using #Processing's #ControlP5 #GUI library with #py5
https://discourse.processing.org/t/controlp5-in-py5/45799/2?u=villares
Read or subscribe to join almost 9000 other #Python people here:
https://www.pythonpapers.com/p/python-pop-quiz-type-addition