Member-only story
5 awesome Python tricks you need to see!
Welcome back! Python has a ton of cool functionality, so let’s talk about some random awesome tricks you can do with Python. Now, these specific tricks are useful with data related tasks, but can also be extended beyond just that based on the project, with that long introduction out of the way, let’s get into it!
Hiding Warnings
There are many situations where you might get a warning, these usually are shown if a package you imported is outdated or you do things in your Python environment that are “legal” but may not be the best way to do it:
If you want to remove these types of warnings, all you have to do is put the following lines of code at the very top of your script:
import warnings
warnings.filterwarnings(action='ignore')
Finding Differences In a List
Next up, an awesome functionality with Python is being able to find the differences in a list. Now, let’s take a look at the following example:
set1 = [ 1, 2, 3, 4, 5 ]set2 = [ 3, 4, 5, 6, 7 ]