Posts

Showing posts from September, 2019

How to normalize dataframe column(s) values in range 0-1

How to resolve anaconda-navigator: command not found error

If anaconda navigator is freshly installed on system then run this in terminal $ export PATH=/home/userName/anaconda3/bin:$PATH else run below $ source ~/anaconda3/bin/activate root $ anaconda-navigator

Converting date time timestamps to Unix time

Image
Photo by Nathan Dumlao on Unsplash Here we will see how to convert date time timestamps to Unix time. Unix stores time as number of seconds that have elapsed since the Unix epoch. Unix epoch is the time 00:00:00 UTC on 1/1/1970. We first generate timestamps using: Now we convert these timestamps into Unix time using:

Basic introduction to working with time series data

Image
Image by annca from Pixabay This is a basic introduction to working with Time Series data using Pandas which is a powerful python library for data manipulation. Let's start with creating a data frame. For the sake of simplicity, our data frame consists of only two columns.   Our data set range can be seen here. If we want to view data from 11th to 20th minute, we can do this using: To view data of first 59 minutes only: We can do above for year or month as well.

How to find if all or any elements of a list are contained in another list

Image
Photo by NordWood Themes on Unsplash Lets create few lists first. To check if all elements in a list are contained in another list: To check if any element in a list is contained in another list:

How to use "coverage" to detect the code that's been executed

Image
source:wallpaperswide.com I have recently been introduced to this wonderful tool aka coverage in Python. This tool is used to measure the effectiveness of test cases. It basically tells us how much of our code is covered by test cases. More information on coverage can be found here . PyCharm Professional edition has built in support for this tool. If you are using PyCharm Community edition then you can run this on terminal. It is very easy to install with pip. So if our code hierarchy looks like below. --- parent directory ------ modules --------- module1.py --------- module2.py ------ tests --------- tests.py This is how we would run coverage to evaluate the code in modules that has been executed by test cases(make sure you are in the parent directory). To view the report, run This will create a directory with the name coveragereport which would contain html reports for all the .py files in modules directory. To view the report, you know what to do...