How to Join Two Text Columns into a Single Column in Pandas?

Often one may want to join two text columns into a new column in a data frame. For example, one may want to combine two columns containing last name and first name into a single column with full name. We can use Pandas’ string manipulation functions to combine two text columns easily. There are a… Continue reading How to Join Two Text Columns into a Single Column in Pandas?

How to Split a Single Column in Pandas into Multiple Columns

Often you may have a column in your pandas data frame and you may want to split the column and make it into two columns in the data frame. For example, one of the columns in your data frame is full name and you may want to split into first name and last name (like… Continue reading How to Split a Single Column in Pandas into Multiple Columns

String Manipulations in Pandas

Python is known for its ability to manipulate strings. Pandas extends Python’s ability to do string manipulations on a data frame by offering a suit of most common string operations that are vectorized and are great for cleaning real world datasets. Let us some simple examples of string manipulations in Pandas Let us use gapminder… Continue reading String Manipulations in Pandas

How To Convert a Column to Row Name/Index in Pandas?

Pandas has a method set_index to covert a column in Pandas dataframe into rowname or row index. Let us see an example of converting a column name into rowname in Pandas. Let us load pandas as “pd”. Let us use real-world gapminder data from vega_datasets. Convert a Column to Row Name Let us convert the… Continue reading How To Convert a Column to Row Name/Index in Pandas?

vega_datasets: A Python Package for Datasets

When you are trying to learn the basics of data science or trying out a new Machine Learning algorithm, an important thing you need is a suitable real world dataset. Often, getting the data set in the right format may be tricky and one may need to spend too much time to search, download and… Continue reading vega_datasets: A Python Package for Datasets