Python: Find an Index (or all) of a Substring in a String
Learn how to find the index of the first or last substring of a string using Python. Also learn how to find all indices of a substring.
Learn how to find the index of the first or last substring of a string using Python. Also learn how to find all indices of a substring.
Learn how to print all of a Python object’s attributes using the dir() and vars() functions, and how to print pretty using the pprint module.
Learn how to split a Python list into n chunks, including how to split a list into different sized sublists or a different number of sublists.
Learn how to get all combinations of a Python list, including with substitution, using the helpful itertools library.
Learn how to remove a Python dictionary key, using the pop method, the del keyword, and how to remove multiple Python dictionary keys.
Learn how to rename a Pandas index, including a single index or multi-index, as well as how to drop an index name altogether.
Learn how to use Python to flatten a list of lists, including using the itertools library, list comprehension, and multi-level lists of lists.
Learn how to create inline if statements in Python, often known as the Python ternary operator, allowing you to apply conditions inline.
Learn how to use Pandas to count unique values in a GroupBy object, allowing you to count distinct values using the popular groupby method.
In this post, you’ll learn how to use Python to remove newline characters from strings, including how to replace all or trailing newlines.
Learn how to use Python to get the last item from a list, or the last n items from a list, as well as how Python list indexing works.
Learn how to use Pandas to add days to a date column, both constant values and based off another column, using the Pandas timedelta function.