GitLab wurde erfolgreich aktualisiert. Durch regelmäßige Updates bleibt das THM GitLab sicher. Danke für Ihre Geduld.

Commit 4701afd4 authored by Jens Plüddemann's avatar Jens Plüddemann

added pearson_correlation_coefficient

parent 231d7279
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
class SalaryData:
def __init__(self, file_path: str):
self.df = pd.read_csv(file_path)
self.years = self.df['YearsExperience']
self.salary = self.df['Salary']
def plot_initial(self):
plt.scatter(self.years, self.salary)
def pearson_correlation_coefficient(self):
r = np.corrcoef(self.years, self.salary)[1, 0]
if __name__ == '__main__':
data_set = SalaryData('../../res/Salary_Data.csv')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment