Boxplots mit Pandas: AttributeError: 'tuple' object has no attribute 'boxplot'

mit matplotlib, NumPy, pandas, SciPy, SymPy und weiteren mathematischen Programmbibliotheken.
Antworten
viktor11
User
Beiträge: 3
Registriert: Montag 21. Februar 2022, 16:31

Hallo zusammen!

Ich bin absoluter Einsteiger mit Python und versuche, eine Grafik mit 6 Boxplots von verschiedenen Datenreihen (SAM_x1 - SAM_x6) zu erstellen. Dabei tritt beim letzten Schritt leider ein Error auf: AttributeError: 'tuple' object has no attribute 'boxplot'

Kann mir jemand sagen, wie ich das fixen kann? Habe schon gelesen, dass ich das tuple zu einer list umwandeln sollte, bin daran aber gescheitert.
Hier der Code, den ich bis jetzt habe:

Code: Alles auswählen

[size=85]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"))
  
# Creating dataset
def list_performanceValues():

    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]
    return SAM_x1, SAM_x2, SAM_x3, SAM_x4, SAM_x5, SAM_x6 



performance_data = (SAM_x1, SAM_x2, SAM_x3, SAM_x4, SAM_x5, SAM_x6)


fig = plt.figure(figsize =(10, 7))

performance_data.boxplot


---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Input In [155], in <module>
     14 performance_data = (SAM_x1, SAM_x2, SAM_x3, SAM_x4, SAM_x5, SAM_x6)
     17 fig = plt.figure(figsize =(10, 7))
---> 19 performance_data.boxplot

AttributeError: 'tuple' object has no attribute 'boxplot'[/size]

Danke schonmal für eure Unterstützung!
Antworten