Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pandas as pd
- import matplotlib.pyplot as plt
- # Replace 'B5 segmentSummary (1).csv' with the actual CSV file path
- file_path = 'B5 segmentSummary (1).csv'
- # Define the range of column positions you want to analyze (columns 6 through 10)
- start_column_position = 6 # Corresponds to column 6
- end_column_position = 9 # Corresponds to column 10
- # Read the CSV file into a Pandas DataFrame
- df = pd.read_csv(file_path)
- # Select columns 6 through 10 for analysis
- selected_columns = df.iloc[:, start_column_position:end_column_position + 1]
- # Calculate summary statistics for the selected columns
- summary_statistics = selected_columns.describe()
- # Transpose the summary statistics for plotting
- summary_statistics = summary_statistics.T
- # Create a bar plot for the mean values
- plt.figure(figsize=(10, 6))
- plt.bar(summary_statistics.index, summary_statistics['mean'])
- plt.xlabel('Columns')
- plt.ylabel('Mean')
- plt.title('Mean Values for Selected Columns')
- plt.xticks(rotation=45)
- plt.tight_layout()
- # Show the plot
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement