euclidean distance finding using pandas

by Mariappan M   Last Updated September 22, 2019 02:26 AM - source

I have 5 coloums 1000+ rows csv file. I found the mean value. However, I need your help to apply euclidean distance algorithm and fill the Missing value. Kindly help me, folks.

import pandas as pd
import numpy as np
from numpy import nan
import csv
from pandas import DataFrame

# Read csv file into a pandas dataframe

df = pd.read_csv(".\SampleData.csv", na_values = missing_values)
print (df)

#Fill the mean value on missing cells

df.fillna(df.mean())

#Fill the Mean value based on Class - Task2
print("Missing fields filled based on Class Value")
df = df.fillna(df.groupby('Class').transform('mean'))
print(df)````

I completed finding the mean value to fill the Missing values


Related Questions


Pandas acessing rows with nan

Updated July 17, 2018 14:26 PM



Pandas dataframe group by order

Updated October 15, 2018 15:26 PM