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 […]
Python
3 Ways to Read a File and Skip Initial Comments in Python
Reading a text file line by line is one of the common activities you do while dealing with a big text file. Often, you are not interested in initial few lines and want to skip them and work with rest of the file. The initial few lines of the text file that you want to […]
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 […]
How to Compute Executing Time in Python?
It is really good to know whether the code you wrote is efficient or fast. We can test that by checking how long it takes to execute certain commands, or functions. Computing Execution Time With “time” Module One way to get the execution time is to use the built-in time module and its function time.time. […]