Bring Your Logic using Python
341 subscribers
109 photos
1 video
4 files
544 links
Logic building using Python : Materials, links, e-books and Code snippets
Download Telegram
The fastest way to read a CSV in Pandas

This article covers:
1. Pandas’ default CSV reading.
2. The faster, more parallel CSV reader introduced in v1.4.
3. A different approach that can make things even faster.

https://pythonspeed.com/articles/pandas-read-csv-fast/
#Snippet
Useful constants in #python

Using #Python's calendar module + the enumerate built-in to make a mapping of month names -> numbers

>>> import calendar
>>> MONTH_NAMES_TO_NUMBERS = {
... v: k for k, v in enumerate(calendar.month_abbr[1:], start=1)
... }

>>> MONTH_NAMES_TO_NUMBERS
{'Jan': 1, 'Feb': 2, 'Mar': 3, 'Apr': 4, 'May': 5, 'Jun': 6, 'Jul': 7, 'Aug': 8, 'Sep': 9, 'Oct': 10, 'Nov': 11, 'Dec': 12}
How to send a tweet with #Python and TweePy in under 10 lines of code

🐍🔥

For more information, refer the Twitter thread given below👇🏻
Invert binary tree in Python

Binary tree
is a data structure and one of the simplest form of trees. You might have heard about people complaining that during interviews they are asked to invert a binary tree.

It may sound like something difficult, but this article shows a really simple solution using recursion.

https://bmwlog.pp.ua/invert-binary-tree-in-python/