import os import pandas as pd import openpyxl from scipy import stats # location will help to open files in the same directory as the py-script __location__ = os.path.realpath( os.path.join(os.getcwd(), os.path.dirname(__file__))) df = pd.read_csv(__location__ + '/autos.txt', sep=";") df = df[:12] print(df) mw = df.mean() print(mw) sta = df.std() print(sta) analysis = pd.DataFrame({"Mittelwert": mw, "Standardabw.": sta}) print(analysis) analysis.to_excel(__location__ + "/auswertung.xlsx") corr = stats.pearsonr(df["Weight"], df["Volume"]) print("Corr:", corr)