Python Hex String to Decimal

Question πŸ’¬ How to convert a hexadecimal string to a decimal integer value in Python? Answer Summary To convert a hex string to a decimal integer value, pass the hex string into the int() function with base argument such as int(‘0xfff’, base=16), or eval() function such as eval(‘0xfff’). The result is a decimal integer value … Read more

How to Filter Data from an Excel File in Python with Pandas

Problem Formulation and Solution Overview This article will show different ways to read and filter an Excel file in Python. To make it more interesting, we have the following scenario: Sven is a Senior Coder at K-Paddles. K-Paddles manufactures Kayak Paddles made of Kevlar for the White Water Rafting Community. Sven has been asked to … Read more

6 Ways to Remove Python List Elements

Problem Formulation and Solution Overview This article will show you how 6 ways to remove List elements in Python. To make it more interesting, we have the following running scenario: Suppose you have a Christmas List containing everyone to buy a gift for. Once a gift is purchased, remove this person from the List. Once … Read more

Python Return Integer From Function

Do you need to create a function that returns an integer value but you don’t know how? No worries, in sixty seconds, you’ll know! Go! πŸ”₯πŸ”₯πŸ”₯ A Python function can return any object. To return an integer, use the built-in int() function. Or create your own function with an arbitrary expression within the function body … Read more

Python Return Float From Function

Do you need to create a function that returns a float but you don’t know how? No worries, in sixty seconds, you’ll know! Go! πŸ”₯πŸ”₯πŸ”₯ A Python function can return any object such as a float value such as 3.14. To return a float, you can use the built-in float() function or create your own … Read more

TypeError Built-in Function or Method Not Subscriptable (Fixed)

Overview 🌞 Do you encounter this stupid error? TypeError: ‘builtin_function_or_method’ object is not subscriptable You’re not alone—thousands of coders like you experience this error in thousands of projects every month. This short tutorial will show you exactly why this error occurs, how to fix it, and how to never make the same mistake again. So, … Read more

How to Save and Load Machine Learning Models in Python

In this tutorial, you will learn –  How to create a basic linear regression model How to save and load an ML model using Pickle module How to save and load an ML model using Joblib module Background and Motivation Over the past years, Machine Learning (ML) has grown in importance with easy access to … Read more