by Suf | Mar 19, 2022 | Programming, Python, Tips
In Python, you can use the datetime library to work with dates and times. The datetime.strftime() method converts a datetime object containing a date and time to different string formats. You cannot call strftime() on a string object because strftime() is not a method...
by Suf | Mar 18, 2022 | Programming, Python, Tips
In Python, a Pandas Series is a one-dimensional labelled array capable of holding data of any type. Pandas Series is the same as a column in an Excel spreadsheet. If you have string entries in a Series object that you want to split, you cannot use the string method...
by Suf | Mar 18, 2022 | Programming, Python, Tips
In Python, a set is an unordered collection of unique elements. The append() method belongs to the List data type. If you try to call the append() method on a set to add elements to the set, you will raise the AttributeError: ‘set’ object has no attribute...
by Suf | Mar 18, 2022 | Programming, Python, Tips
The built-in raw_input() function in Python 2 does not exist in Python 3. In Python 3, we can use the function input() to collect input from the user of a program If you try to use raw_input() in a Python 3 program, you will raise the NameError: name...
by Suf | Mar 18, 2022 | Programming, Python, Tips
The built-in xrange() method in Python 2 does not exist in Python 3. In Python 3, we can use the function range() to produce a range of numbers. If you try to use xrange() in a Python 3 program, you will raise the NameError: name ‘xrange’ is not defined....
by Suf | Mar 17, 2022 | Programming, Python, Tips
In Python, strings are immutable arrays of bytes representing Unicode characters. The pop() method belongs to the List data type and removes the element at the specified position. If you try to call pop() on a string, you will raise the AttributeError:...