How to convert a date to a string in Python and Pandas?

In this data analysis tutorial we will learn how to cast datetime objects to strings in general Python programming tasks and during Data Analysis. Cast a date to string in Python We will Let’s create a datetime object: We will get the following date object: 2023-12-01 00:00:00 If we look at its type we’ll see … Read more

How to convert an hex number to binary in Python?

Problem We would like to convert an hexadecimal number to a binary number system (or from base 16 to base 2). Let’s assume that we have the following hexadecimal (which represent the integer value 512) Running a simple conversion using the bin() function renders a TypeError exception: TypeError: ‘str’ object cannot be interpreted as an … Read more