9951 explained code solutions for 126 technologies


python-pandasGet dataframe variance using var()


import pandas as pd

df = pd.DataFrame({
  'Phone': ['ip5', 'ip6', 'ip8', 'sms', 'xi'],
  'Phone Price': [204, 304, 404, 405, 305]
})

variance = df['Phone Price'].var()ctrl + c
import pandas as pd

load Pandas module

pd.DataFrame

creates Pandas DataFrame object

'Phone Price'

column to calculate variance for

.var()

returns unbiased variance for given dataframe