Often while working with pandas dataframe you might have a column with categorical variables, string/characters, and you want to find the frequency counts of each unique elements present in the column. Pandas’ value_counts() easily let you get the frequency counts. Let us get started with an example from a real world data set. Load gapminder […]
Python Tips
Installing Python 3 from Python 2 with Anaconda
If you have already installed Anaconda 2.7 and finally decided to take a plunge into Python 3 and want to install Python 3. Congrats. You don’t have to start fresh. You can easily upgrade to Python 3 using Anaconda package manager by creating new environment for Python 3. Note that this virtual environment is completely […]
How to Install Packages from the Jupyter Notebook?
Python package managers, like Anaconda and pip, have made our life much simpler working with Python in different operating systems. However, if you work long enough, you are likely to encounter weird installation problems. One such problem is even if you have installed a package, you won’t be able to import it in the Jupyter […]
How to Get Unique Values from a Column in Pandas Data Frame?
In this tutorial, we will learn how to get unique values of a column in a Pandas dataframe using two approaches. We will first use Pandas unique() function to get unique values of a column and then use Pandas drop_duplicates() function to get unique values of a column. Pandas unique() function To Get Unique values […]
How To Add a New Column Using a Dictionary in Pandas Data Frame ?
Creating a new column to a dataframe is a common task in doing data analysis. And this task often comes in a variety of forms. Earlier we saw how to add a column using an existing columns in two ways. In this post we will learn how to add a new column using a dictionary […]