Mastering String Methods in Pandas
Pandas is a popular python library that enables easy to use data structures and data analysis tools. Pandas can be used for reading in data, generating statistics, aggregating, feature engineering for machine learning and much more. The Pandas library also provides a suite of tools for string/text manipulation. In this post, we will walk through some of the most important string manipulation methods provided by pandas. Let’s get started! First, let’s import the Pandas library import pandas as pd Now, let’s define an example pandas series containing strings: s = pd.Series(['python is awesome', 'java is just ok', 'c++ is overrated']) Let’s print this series: print(s) We notice that the series has ‘dtype: object’, which is the default type automatically inferred. In general, it is better to have a dedicated type. Since the release of Pandas 1.0, we are now able to specify dedicated types. Make sure Pandas is updated by executing the followi...