Just about every day, my students ask great questions. I love sharing those questions (and my answers), along with other resources to help you improve your Python/Pandas fluency.
import rich
rich.print('Have a good day! :smile:')
Just use :NAME: for the emoji you want. I usually use the "shortcodes" part of Emojipedia's "technical" tab.
import rich
rich.print('Have a good day! :smile:')
Just use :NAME: for the emoji you want. I usually use the "shortcodes" part of Emojipedia's "technical" tab.
import rich
rich.print('Hello [blue on yellow]out there[/blue on yellow]!')
rich.print is a superset of the "print" builtin, but lets you add styling. Some people even "from rich import print".
import rich
rich.print('Hello [blue on yellow]out there[/blue on yellow]!')
rich.print is a superset of the "print" builtin, but lets you add styling. Some people even "from rich import print".
from rich.prompt import Prompt
user_is_happy = Prompt.ask('Are you happy?', choices=['yes', 'no'])
Bad input? The user has to try again.
from rich.prompt import Prompt
user_is_happy = Prompt.ask('Are you happy?', choices=['yes', 'no'])
Bad input? The user has to try again.
from rich.prompt import Prompt
name = Prompt.ask('Enter your name')
It adds a colon and strips the user's input -- convenient and useful!
from rich.prompt import Prompt
name = Prompt.ask('Enter your name')
It adds a colon and strips the user's input -- convenient and useful!
You can change it temporarily with mode.max_threads:
with pd.option_context('mode.max_threads', 10):
df = pd.read_csv('bigfile.csv')
Note: More threads aren't always faster!
You can change it temporarily with mode.max_threads:
with pd.option_context('mode.max_threads', 10):
df = pd.read_csv('bigfile.csv')
Note: More threads aren't always faster!
Today I’m launching Vibe to Valid: I audit vibe-coded #Python apps, tell you what’s wrong (and right), and can fix it.
Free intro call: buff.ly/0Q6lgtk
Today I’m launching Vibe to Valid: I audit vibe-coded #Python apps, tell you what’s wrong (and right), and can fix it.
Free intro call: buff.ly/0Q6lgtk
• 4 hours of video
• Hands-on exercises
• Practical advice from my personal coding experience
It's included in a LernerPython membership. Check it out (with a 2-week free trial) at buff.ly/ET6nSz1 !
• 4 hours of video
• Hands-on exercises
• Practical advice from my personal coding experience
It's included in a LernerPython membership. Check it out (with a 2-week free trial) at buff.ly/ET6nSz1 !
df.assign(xy = pd.col('x') * pd.col('y'))
"select" in Pandas 3.1 treats kwargs like assign, dropping columns you don't name:
df.select('x', 'y', 'z',
xy = pd.col('x') * pd.col('y'))
df.assign(xy = pd.col('x') * pd.col('y'))
"select" in Pandas 3.1 treats kwargs like assign, dropping columns you don't name:
df.select('x', 'y', 'z',
xy = pd.col('x') * pd.col('y'))
df[['x', 'y']]
But now, with version 3.1, you can use the "select" method:
df.select('x', 'y')
df[['x', 'y']]
But now, with version 3.1, you can use the "select" method:
df.select('x', 'y')
Given:
[[10, 20, 30], [40, 50, 60], [70, 80]]
We can get the individual numbers, but cannot run str on each. For that, we still need a nested comprehension.
Given:
[[10, 20, 30], [40, 50, 60], [70, 80]]
We can get the individual numbers, but cannot run str on each. For that, we still need a nested comprehension.
x = [[10, 20], [20, 30, 40], [40, 50, 60]]
{*n for n in x} # returns {10, 20, 30, 40, 50, 60}
x = [[10, 20], [20, 30, 40], [40, 50, 60]]
{*n for n in x} # returns {10, 20, 30, 40, 50, 60}
In the latest Bamboo Weekly, we look at the history of crypto hacks with #Python #Pandas, learning whether such thefts are increasing over time — and how much, on average, the thieves get.
Level up your data analysis skills every week at buff.ly/f9mDmTb
In the latest Bamboo Weekly, we look at the history of crypto hacks with #Python #Pandas, learning whether such thefts are increasing over time — and how much, on average, the thieves get.
Level up your data analysis skills every week at buff.ly/f9mDmTb
x = [[10, 20, 30], [40, 50, 60], [70, 80]]
Use a nested list comprehension:
[n
for sublist in x
for n in sublist]
Or use the new unpacking syntax:
[*n for n in x] # same thing!
x = [[10, 20, 30], [40, 50, 60], [70, 80]]
Use a nested list comprehension:
[n
for sublist in x
for n in sublist]
Or use the new unpacking syntax:
[*n for n in x] # same thing!
Wires → assembly → C → #Python → AI: each abstraction let more people solve bigger problems.
What should we teach now?
buff.ly/MizDkzt
Wires → assembly → C → #Python → AI: each abstraction let more people solve bigger problems.
What should we teach now?
buff.ly/MizDkzt