Home > OS >  Calculate and show the difference between the max value and min value from a column in pandas
Calculate and show the difference between the max value and min value from a column in pandas

Time:04-02

import pandas as pd
import numpy as np
import datetime
import matplotlib.pyplot as plt 
vacc = pd.read_csv("Vacc.csv", parse_dates=['date'],dayfirst=True) 

CountryInterest = vacc.query("country == 'United Kingdom' | country == 'Romania' | country == 'Bulgaria' | country == 'Brazil' | country == 'United Arab Emirates'")
Interest = CountryInterest['country']

vaccinated = vacc.query("date >= '20/01/2021' & date <= '03/02/2021'")
VaccCountry = vaccinated['people_fully_vaccinated_per_hundred']

the image is to show you the names of the columns

CodePudding user response:

You can use numpy.ptp:

np.ptp(vaccinated['people_fully_vaccinated_per_hundred'])

CodePudding user response:

I can't see the values, and I can't comment yet.

vacc['people_fully_vaccinated_per_hundred'].describe()

The above should give you the min,max, count, and mean etc

  • Related