Pinned Tweet
Hello folks! I have finally decided to create a Twitter account for programming. Let's share, discuss and learn from each other!
Augusto Lovelace retweeted
#pythontip by Vojtech Filipec:
To extract last N characters of DataFrame's column, use
df.col.str[-N:]
Example:
Augusto Lovelace retweeted
Something, I have learned teaching Python course last week - there is a method that tries to express given float as a fraction of two integers:
>>> a = 0.5
>>> a.as_integer_ratio()
(1, 2)
>>> (0.75).as_integer_ratio()
(3, 4)
Augusto Lovelace retweeted
To split an iterable into two iterables based on some test function, use more_itertools.partition.
E.g.
from more_itertools import partition
Augusto Lovelace retweeted
Learn how to use Python to generate a QR code with a URL (or any other desired text):
import qrcode
qr = qrcode.QRCode()
qr.add_data('nitter.cf/python_tip')
qr.make()
qr.make_image(fill_color="black", back_color="white")
Colab demo:
gist.github.com/simecek/7f9cβ¦
Augusto Lovelace retweeted
Nice little prettier plugin to handle long arrays that get formatted like a giraffe
github.com/electrovir/prettiβ¦






