Often you may want to create a new variable either from column names of a pandas data frame or from one of the columns of the data frame. Just like Python, Pandas has great string manipulation abilities that lets you manipulate strings easily. Let us see an example of using Pandas to manipulate column names […]
Python Tips
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 […]
How To Reset Index in Pandas Dataframe?
In this post, we will learn how to reset index in Pandas dataframe starting from zero. We will use pandas reset_index() function to reset index of a dataframe. Often you start with a big dataframe in Pandas and after manipulating and filtering the data frame you will end up with much smaller data frame. When […]
How To Drop One or More Columns in Pandas Dataframe?
Often while working with a bigger pandas dataframe with multiple columns, one wants to drop a column or multiple columns from a pandas dataframe. One typically drops columns, if the columns are not needed for further analysis. Pandas drop function allows you to drop/remove one or more columns from a dataframe. Let us see some […]
How To Concatenate Arrays in NumPy?
Often you may have two or more NumPY arrays and want to concatenate/join/merge them into a single array. Python offers multiple options to join/concatenate NumPy arrays. Common operations include given two 2d-arrays, how can we concatenate them row wise or column wise. NumPy’s concatenate function allows you to concatenate two arrays either by rows or […]