Wpis z mikrobloga

@pamareum:
def drawbarplot():
plt.figure(figsize=(14,6))
xvalues = averageviewsbymonth['rok i miesiac']
yvalues = averageviewsbymonth['value']
plt.title('Daily freeCodeCamp Forum Page Views 5/2016-12/2019')
plt.xlabel('date')


plt.bar(xvalues, yvalues, width=0.5)
plt.xticks(averageviewsbymonth['rok i miesiac'])
plt.xticks(rotation=45)

draw
barplot()

w average
viewsbymonth są kolumny rok, miesiac, rok i miesiac oraz value
@Niedoszly_Doomer: Masz tu na szybko z ChataGPT:

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd

# Create a sample dataframe similar to the user's description
data = {
'rok i miesiac': [f'{year}-{month:02d}' for year in range(2016, 2020) for month in range(1, 13)],
'value': np.random.randint(50000, 150000, 48)
}
averageviewsbymonth = pd.DataFrame(data)

# The modified drawbarplot function with sample data
def drawbarplot(averageviewsbymonth):
# Assuming 'averageviewsbymonth' is a DataFrame with
@Niedoszly_Doomer: Sprobuj ten:

def drawbarplot(averageviewsbymonth):
plt.figure(figsize=(14,6))

# Assume 'averageviewsbymonth' is a DataFrame with 'Year' and 'Month' as index levels
# and 'value' as the column with the data to be plotted.
# We'll create an array of group positions on the X axis for each year:
years = averageviewsbymonth.index.levels[0]
months = averageviewsbymonth.index.levels[1]
n_months = len(months)
width = 0.1 # Width of the bars
ind = np.arange(len(years)) # The x locations for