Meine Aufgabe ist es, die hier dargestellten Datenreihen SAM_x1 bis SAM_x6 in Violin-Plots darzustellen und zu vergleichen. Leider bekomme ich bei meinem Code folgende Fehlermeldung:
Code: Alles auswählen
Input In [114]
axs[0, 0].violinplot,(data, pos, points=20, widths=0.3,
^
SyntaxError: invalid syntax
Kann mir jemand erklären, was hier bei der Schreibweise falsch ist?
Hier der Code:
Code: Alles auswählen
from matplotlib import pyplot as plt
import pandas as pd
# Read and store content
# of an excel file
read_file = pd.read_excel (r'performance_tests.xlsx', sheet_name='Common_short')
# Write the dataframe object
# into csv file
read_file.to_csv ("performance_tests.csv",
index = None,
header=True)
# read csv file and convert
# into a dataframe object
df = pd.DataFrame(pd.read_csv("performance_tests.csv"))
# show the dataframe
df
SAM_x1 = df.iloc[3:193, 2]
SAM_x2 = df.iloc[3:193, 4]
SAM_x3 = df.iloc[3:193, 6]
SAM_x4 = df.iloc[3:193, 8]
SAM_x5 = df.iloc[3:193, 10]
SAM_x6 = df.iloc[3:193, 12]
pos = [SAM_x1, SAM_x2, SAM_x3, SAM_x4, SAM_x5, SAM_x6]
fig, axs = plt.subplots(nrows=2, ncols=3, figsize=(10, 6))
axs[0, 0].violinplot,(data, pos, points=20, widths=0.3,
showmeans=True, showextrema=True, showmedians=True)
axs[0, 0].set_title('Custom violinplot 1', fontsize=fs)
Danke und Viele Grüße
viktor