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
A skill the world needs for a better tomorrow

To be or not to be, to do or not to do, to blog or not to blog; It’s been a dilemma for more than three years to write about this topic and post it as a blog. The matter may not be serious as Hamlet’s dilemma, whether to exist or not, but equally significant and sensitive, and hence the predicament. It is a critical skill, a subject studied and deliberated from 450 BC till today and has the power to change the entire world. Writer and poet Javed Akhtar, in the year 2020, received the Richard Dawkins International award for being a practitioner and subject matter expert on this topic. I reckon you got it. Yes, I am talking about Critical Thinking, a skill to help us reason out and establish what to believe and what not to.

Read more @ https://georgekoshi.com/2021/10/09/a-skill-the-world-needs-for-a-better-tomorrow/
By default, the new column is added at the end of #pandas DataFrame.

To insert a column at a specific column index, use

DataFrame.insert(loc, column, value)
#Tip #Python

bin() and int() convert between a binary string (prefixed with "0b") and an integer number:

>>> bin(101)
'0b1100101'
>>> int('0b00011001', 2)
25


That could be useful for bitwise binary operators like AND, OR or XOR:

>>> a, b = 101, 25
>>> a & b
1
>>> a | b
125
>>> a ^ b
124
Did you know that you can give #Python's print an iterator and a separator?

So in this example you don't need the for loop
Elegant #Python: use * to unpack a sequence.
#Python functions are first-class objects so you can access their attributes like this.
The #Python requests library lets you conveniently choose if you want to raise an exception or not.
Did you know #Python's random module has a function called "randrange" that lets you choose a random item from range(start, stop[, step]) ?