# history

source:
  pd.DataFrame([
      ['2022/3/15',7],
      ['2022/3/22',8],
      ['2022/3/24',6],
      ['2022/4/31',9],
      ['2022/4/5',7],
      ['2022/4/7',6],
      ['2022/4/12',10]
      ['2022/4/14',8],
      ['2022/4/19',6],
      ['2022/4/26',10]
      ['2022/4/28',11],
      ['2022/5/3',8],
      ['2022/5/5',9],
      ['2022/5/10',8],
      ['2022/5/17',7],
      ['2022/5/19',5]
  ])

source_raw:
  pd.DataFrame([
      ['2022/3/15',7],
      ['2022/3/22',8],
      ['2022/3/24',6],
      ['2022/4/31',9],
      ['2022/4/5',7],
      ['2022/4/7',6],
      ['2022/4/12',10]
      ['2022/4/14',8],
      ['2022/4/19',6],
      ['2022/4/26',10]
      ['2022/4/28',11],
      ['2022/5/3',8],
      ['2022/5/5',9],
      ['2022/5/10',8],
      ['2022/5/17',7],
      ['2022/5/19',5]
  ])


source:
  pd.DataFrame([
      ['2022/3/15',7],
      ['2022/3/22',8],
      ['2022/3/24',6],
      ['2022/4/31',9],
      ['2022/4/5',7],
      ['2022/4/7',6],
      ['2022/4/12',10]
      ['2022/4/14',8],
      ['2022/4/19',6],
      ['2022/4/26',10],
      ['2022/4/28',11],
      ['2022/5/3',8],
      ['2022/5/5',9],
      ['2022/5/10',8],
      ['2022/5/17',7],
      ['2022/5/19',5]
  ])

source_raw:
  pd.DataFrame([
      ['2022/3/15',7],
      ['2022/3/22',8],
      ['2022/3/24',6],
      ['2022/4/31',9],
      ['2022/4/5',7],
      ['2022/4/7',6],
      ['2022/4/12',10]
      ['2022/4/14',8],
      ['2022/4/19',6],
      ['2022/4/26',10],
      ['2022/4/28',11],
      ['2022/5/3',8],
      ['2022/5/5',9],
      ['2022/5/10',8],
      ['2022/5/17',7],
      ['2022/5/19',5]
  ])


source:
  pd.DataFrame([
      ['2022/3/15',7],
      ['2022/3/22',8],
      ['2022/3/24',6],
      ['2022/4/31',9],
      ['2022/4/5',7],
      ['2022/4/7',6],
      ['2022/4/12',10]
      ['2022/4/14',8],
      ['2022/4/19',6],
      ['2022/4/26',10],
      ['2022/4/28',11],
      ['2022/5/3',8],
      ['2022/5/5',9],
      ['2022/5/10',8],
      ['2022/5/17',7],
      ['2022/5/19',5],
  ])

source_raw:
  pd.DataFrame([
      ['2022/3/15',7],
      ['2022/3/22',8],
      ['2022/3/24',6],
      ['2022/4/31',9],
      ['2022/4/5',7],
      ['2022/4/7',6],
      ['2022/4/12',10]
      ['2022/4/14',8],
      ['2022/4/19',6],
      ['2022/4/26',10],
      ['2022/4/28',11],
      ['2022/5/3',8],
      ['2022/5/5',9],
      ['2022/5/10',8],
      ['2022/5/17',7],
      ['2022/5/19',5],
  ])


source:
  pd.DataFrame([
      ['2022/3/15',7],
      ['2022/3/22',8],
      ['2022/3/24',6],
      ['2022/4/31',9],
      ['2022/4/5',7],
      ['2022/4/7',6],
      ['2022/4/12',10],
      ['2022/4/14',8],
      ['2022/4/19',6],
      ['2022/4/26',10],
      ['2022/4/28',11],
      ['2022/5/3',8],
      ['2022/5/5',9],
      ['2022/5/10',8],
      ['2022/5/17',7],
      ['2022/5/19',5],
  ])

source_raw:
  pd.DataFrame([
      ['2022/3/15',7],
      ['2022/3/22',8],
      ['2022/3/24',6],
      ['2022/4/31',9],
      ['2022/4/5',7],
      ['2022/4/7',6],
      ['2022/4/12',10],
      ['2022/4/14',8],
      ['2022/4/19',6],
      ['2022/4/26',10],
      ['2022/4/28',11],
      ['2022/5/3',8],
      ['2022/5/5',9],
      ['2022/5/10',8],
      ['2022/5/17',7],
      ['2022/5/19',5],
  ])


source:
  data = [
      ['2022/3/15',7],
      ['2022/3/22',8],
      ['2022/3/24',6],
      ['2022/4/31',9],
      ['2022/4/5',7],
      ['2022/4/7',6],
      ['2022/4/12',10],
      ['2022/4/14',8],
      ['2022/4/19',6],
      ['2022/4/26',10],
      ['2022/4/28',11],
      ['2022/5/3',8],
      ['2022/5/5',9],
      ['2022/5/10',8],
      ['2022/5/17',7],
      ['2022/5/19',5],
  ]

source_raw:
  data = [
      ['2022/3/15',7],
      ['2022/3/22',8],
      ['2022/3/24',6],
      ['2022/4/31',9],
      ['2022/4/5',7],
      ['2022/4/7',6],
      ['2022/4/12',10],
      ['2022/4/14',8],
      ['2022/4/19',6],
      ['2022/4/26',10],
      ['2022/4/28',11],
      ['2022/5/3',8],
      ['2022/5/5',9],
      ['2022/5/10',8],
      ['2022/5/17',7],
      ['2022/5/19',5],
  ]


source_raw:
  %%bash
  wget https://github.com/plotly/datasets/blob/master/Move%20to%20Canada.csv

source:
  get_ipython().run_cell_magic('bash', '', 'wget https://github.com/plotly/datasets/blob/master/Move%20to%20Canada.csv\n')


source:
  fig = go.Figure(
      data=[go.Bar(y=[2, 1, 3])],
      layout_title_text="A Figure Displaying Itself"
  )

source_raw:
  fig = go.Figure(
      data=[go.Bar(y=[2, 1, 3])],
      layout_title_text="A Figure Displaying Itself"
  )


source_raw:
  %matplotlib inline
  plt.bar(df.City[:5],df.Population[:5])
  plt.xlabel("Cities")
  plt.show()

source:
  get_ipython().run_line_magic('matplotlib', 'inline')
  plt.bar(df.City[:5],df.Population[:5])
  plt.xlabel("Cities")
  plt.show()


source_raw:
  %matplotlib inline
  plt.bar(df.City[:10],df.Population[:10])
  plt.xlabel("Cities")
  plt.show()

source:
  get_ipython().run_line_magic('matplotlib', 'inline')
  plt.bar(df.City[:10],df.Population[:10])
  plt.xlabel("Cities")
  plt.show()


source_raw:
  %matplotlib inline
  plt.bar(df.City[:4],df.Population[:4])
  plt.xlabel("Cities")
  plt.show()

source:
  get_ipython().run_line_magic('matplotlib', 'inline')
  plt.bar(df.City[:4],df.Population[:4])
  plt.xlabel("Cities")
  plt.show()


source:
  df.rename(columns={"month":"Month","level_2":"Region","level_3":"Country","value":"total_passenger"},inplace=True)

source_raw:
  df.rename(columns={"month":"Month","level_2":"Region","level_3":"Country","value":"total_passenger"},inplace=True)


source:
  plt.plot(china_yearly,label='China')
  plt.plot(japan_yearly,label='Japan')

  plt.ylabel("Number of Passengers",fontsize=10)
  plt.legend()

  plt.show()

source_raw:
  plt.plot(china_yearly,label='China')
  plt.plot(japan_yearly,label='Japan')

  plt.ylabel("Number of Passengers",fontsize=10)
  plt.legend()

  plt.show()


source:
  plt.plot(china_yearly,label='China')
  plt.plot(japan_yearly,label='Japan')

  plt.ylabel("Number of Passengers",fontsize=10)
  plt.legend()

source_raw:
  plt.plot(china_yearly,label='China')
  plt.plot(japan_yearly,label='Japan')

  plt.ylabel("Number of Passengers",fontsize=10)
  plt.legend()


source:
  get_ipython().run_cell_magic('bash', '', 'curl -O https://raw.githubusercontent.com/PetroIvaniuk/2022-Ukraine-Russia-War-Dataset/main/data/russia_losses_personnel.json\ncurl -O https://raw.githubusercontent.com/PetroIvaniuk/2022-Ukraine-Russia-War-Dataset/main/data/russia_losses_equipment.json\n')

source_raw:
  %%bash
  curl -O https://raw.githubusercontent.com/PetroIvaniuk/2022-Ukraine-Russia-War-Dataset/main/data/russia_losses_personnel.json
  curl -O https://raw.githubusercontent.com/PetroIvaniuk/2022-Ukraine-Russia-War-Dataset/main/data/russia_losses_equipment.json


source:
  russia_losses_personnel = json.load("russia_losses_personnel.json")
  russia_losses_equipment = json.load("russia_losses_equipment.json")

source_raw:
  russia_losses_personnel = json.load("russia_losses_personnel.json")
  russia_losses_equipment = json.load("russia_losses_equipment.json")


source:
  def average_number_of_russians():
      with open('russia_losses_personnel.json') as file:
          data = json.load(file)

source_raw:
  def average_number_of_russians():
      with open('russia_losses_personnel.json') as file:
          data = json.load(file)


source:
  def average_number_of_russians():
      with open('russia_losses_personnel.json') as file:
          data = json.load(file)
      print(data)

source_raw:
  def average_number_of_russians():
      with open('russia_losses_personnel.json') as file:
          data = json.load(file)
      print(data)


source:
  def average_number_of_russians():
      with open('russia_losses_personnel.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[:1]):
          print(a,b)

source_raw:
  def average_number_of_russians():
      with open('russia_losses_personnel.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[:1]):
          print(a,b)


source:
  def average_number_of_russians():
      with open('russia_losses_personnel.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          print(a,b)

source_raw:
  def average_number_of_russians():
      with open('russia_losses_personnel.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          print(a,b)


source:
  def average_number_of_russians() -> list:
      median = []
      with open('russia_losses_personnel.json') as file:
          data = json.load(file)
      
      for a,b in zip(data,data[1:]):
          median.append(a['personnel'] - b['personnel'])
      return median

source_raw:
  def average_number_of_russians() -> list:
      median = []
      with open('russia_losses_personnel.json') as file:
          data = json.load(file)
      
      for a,b in zip(data,data[1:]):
          median.append(a['personnel'] - b['personnel'])
      return median


source:
  def average_number_of_russians() -> list:
      median = []
      with open('russia_losses_personnel.json') as file:
          data = json.load(file)
      
      for a,b in zip(data,data[1:]):
          median.append(b['personnel'] - a['personnel'])
      return median

source_raw:
  def average_number_of_russians() -> list:
      median = []
      with open('russia_losses_personnel.json') as file:
          data = json.load(file)
      
      for a,b in zip(data,data[1:]):
          median.append(b['personnel'] - a['personnel'])
      return median


source:
  # Plot data
  avarage_destroyed_russians = average_number_of_russians()[1:7]
  plt.bar(avarage_destroyed_russians)

source_raw:
  # Plot data
  avarage_destroyed_russians = average_number_of_russians()[1:7]
  plt.bar(avarage_destroyed_russians)


source:
  # Plot data
  avarage_destroyed_russians = average_number_of_russians()[:7]
  plt.bar([x for x in range(1,8)],avarage_destroyed_russians)

source_raw:
  # Plot data
  avarage_destroyed_russians = average_number_of_russians()[:7]
  plt.bar([x for x in range(1,8)],avarage_destroyed_russians)


source:
  # Plot data
  avarage_destroyed_russians = average_number_of_russians()[70:77]
  plt.bar([x for x in range(70,77)],avarage_destroyed_russians)

source_raw:
  # Plot data
  avarage_destroyed_russians = average_number_of_russians()[70:77]
  plt.bar([x for x in range(70,77)],avarage_destroyed_russians)


source:
  # Plot data
  avarage_destroyed_russians = average_number_of_russians()[70:78]
  plt.bar([x for x in range(70,78)],avarage_destroyed_russians)

source_raw:
  # Plot data
  avarage_destroyed_russians = average_number_of_russians()[70:78]
  plt.bar([x for x in range(70,78)],avarage_destroyed_russians)


source:
  get_ipython().run_cell_magic('bash', '', 'curl -O https://raw.githubusercontent.com/PetroIvaniuk/2022-Ukraine-Russia-War-Dataset/main/data/russia_losses_personnel.json\n')

source_raw:
  %%bash 
  curl -O https://raw.githubusercontent.com/PetroIvaniuk/2022-Ukraine-Russia-War-Dataset/main/data/russia_losses_personnel.json


source:
  def daily_losses_personnel() -> list:
      personnel_losses = []
      with open('russia_losses_personnel.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          personnel_losses.append(b['personnel'] - a['personnel'])
      return personnel_losses

source_raw:
  def daily_losses_personnel() -> list:
      personnel_losses = []
      with open('russia_losses_personnel.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          personnel_losses.append(b['personnel'] - a['personnel'])
      return personnel_losses


source:
  get_ipython().run_line_magic('matplotlib', 'insert')
  # Example a bar plot.
  start,end = 90,94
  losses_personnel = daily_losses_personnel()
  plt.bar([x for x in range(start,end+1),losses_personnel[start:end+1]])
  print("Median:",sum(losses_personnel) / (len(losses_personnel) + 1) )

source_raw:
  %matplotlib insert
  # Example a bar plot.
  start,end = 90,94
  losses_personnel = daily_losses_personnel()
  plt.bar([x for x in range(start,end+1),losses_personnel[start:end+1]])
  print("Median:",sum(losses_personnel) / (len(losses_personnel) + 1) )


source:
  get_ipython().run_line_magic('matplotlib', 'insert')
  # Example a bar plot.
  start,end = 90,94
  losses_personnel = daily_losses_personnel()
  plt.bar([x for x in range(start,end+1),losses_personnel[start:end+1])
  print("Median:",sum(losses_personnel) / (len(losses_personnel) + 1) )

source_raw:
  %matplotlib insert
  # Example a bar plot.
  start,end = 90,94
  losses_personnel = daily_losses_personnel()
  plt.bar([x for x in range(start,end+1),losses_personnel[start:end+1])
  print("Median:",sum(losses_personnel) / (len(losses_personnel) + 1) )


source:
  get_ipython().run_line_magic('matplotlib', 'insert')
  # Example a bar plot.
  start,end = 90,94
  losses_personnel = daily_losses_personnel()
  plt.bar([x for x in range(start,end+1)],losses_personnel[start:end+1])
  print("Median:",sum(losses_personnel) / (len(losses_personnel) + 1) )

source_raw:
  %matplotlib insert
  # Example a bar plot.
  start,end = 90,94
  losses_personnel = daily_losses_personnel()
  plt.bar([x for x in range(start,end+1)],losses_personnel[start:end+1])
  print("Median:",sum(losses_personnel) / (len(losses_personnel) + 1) )


source:
  # Example a bar plot.
  start,end = 90,94
  losses_personnel = daily_losses_personnel()
  plt.bar([x for x in range(start,end+1)],losses_personnel[start:end+1])
  print("Median:",sum(losses_personnel) / (len(losses_personnel) + 1) )

source_raw:
  # Example a bar plot.
  start,end = 90,94
  losses_personnel = daily_losses_personnel()
  plt.bar([x for x in range(start,end+1)],losses_personnel[start:end+1])
  print("Median:",sum(losses_personnel) / (len(losses_personnel) + 1) )


source:
  # Example a bar plot.
  start,end = 90,94
  losses_personnel = daily_losses_personnel()
  print(losses_personnel)
  plt.bar([x for x in range(start,end+1)],losses_personnel[start:end+1])
  print("Median:",sum(losses_personnel) / (len(losses_personnel) + 1) )

source_raw:
  # Example a bar plot.
  start,end = 90,94
  losses_personnel = daily_losses_personnel()
  print(losses_personnel)
  plt.bar([x for x in range(start,end+1)],losses_personnel[start:end+1])
  print("Median:",sum(losses_personnel) / (len(losses_personnel) + 1) )


source:
  # Example a bar plot.
  start,end = 90,94
  losses_personnel = daily_losses_personnel()[start:end+1]
  plt.bar([x for x in range(start,end+1)],losses_personnel)
  print("Median:",sum(losses_personnel) / (len(losses_personnel) + 1) )

source_raw:
  # Example a bar plot.
  start,end = 90,94
  losses_personnel = daily_losses_personnel()[start:end+1]
  plt.bar([x for x in range(start,end+1)],losses_personnel)
  print("Median:",sum(losses_personnel) / (len(losses_personnel) + 1) )


source:
  # Example a bar plot.
  start = 90,end = 94
  losses_personnel = daily_losses_personnel()[start:end+1]
  plt.bar([x for x in range(start,end+1)],losses_personnel)
  print("Median:",sum(losses_personnel) / (len(losses_personnel) + 1) )

source_raw:
  # Example a bar plot.
  start = 90,end = 94
  losses_personnel = daily_losses_personnel()[start:end+1]
  plt.bar([x for x in range(start,end+1)],losses_personnel)
  print("Median:",sum(losses_personnel) / (len(losses_personnel) + 1) )


source:
  # Example a bar plot.
  start = 90
  end = 94
  losses_personnel = daily_losses_personnel()[start:end+1]
  plt.bar([x for x in range(start,end+1)],losses_personnel)
  print("Median:",sum(losses_personnel) / (len(losses_personnel) + 1) )

source_raw:
  # Example a bar plot.
  start = 90
  end = 94
  losses_personnel = daily_losses_personnel()[start:end+1]
  plt.bar([x for x in range(start,end+1)],losses_personnel)
  print("Median:",sum(losses_personnel) / (len(losses_personnel) + 1) )


source:
  # Example a bar plot.
  start = 90
  end = 94
  losses_personnel = daily_losses_personnel()[start:end+1]
  plt.bar([x for x in range(start,end+1)],losses_personnel)
  #print("Median:",sum(losses_personnel) / (len(losses_personnel) + 1) )

source_raw:
  # Example a bar plot.
  start = 90
  end = 94
  losses_personnel = daily_losses_personnel()[start:end+1]
  plt.bar([x for x in range(start,end+1)],losses_personnel)
  #print("Median:",sum(losses_personnel) / (len(losses_personnel) + 1) )


source:
  # Example a bar plot.
  start = 80
  end = 87
  losses_personnel = daily_losses_personnel()[start:end+1]
  plt.bar([x for x in range(start,end+1)],losses_personnel)
  #print("Median:",sum(losses_personnel) / (len(losses_personnel) + 1) )

source_raw:
  # Example a bar plot.
  start = 80
  end = 87
  losses_personnel = daily_losses_personnel()[start:end+1]
  plt.bar([x for x in range(start,end+1)],losses_personnel)
  #print("Median:",sum(losses_personnel) / (len(losses_personnel) + 1) )


source:
  # Example a bar plot.
  start = 80
  end = 87
  losses_personnel = daily_losses_personnel()[start:end+1]
  plt.bar([x for x in range(start,end+1)],losses_personnel)
  print("Median:",sum(losses_personnel) / (len(losses_personnel) + 1) )

source_raw:
  # Example a bar plot.
  start = 80
  end = 87
  losses_personnel = daily_losses_personnel()[start:end+1]
  plt.bar([x for x in range(start,end+1)],losses_personnel)
  print("Median:",sum(losses_personnel) / (len(losses_personnel) + 1) )


source:
  # Example a bar plot.
  start,end = 80,87
  losses_personnel = daily_losses_personnel()[start:end+1]
  plt.bar([x for x in range(start,end+1)],losses_personnel)
  print("Median:",sum(losses_personnel) / (len(losses_personnel) + 1) )

source_raw:
  # Example a bar plot.
  start,end = 80,87
  losses_personnel = daily_losses_personnel()[start:end+1]
  plt.bar([x for x in range(start,end+1)],losses_personnel)
  print("Median:",sum(losses_personnel) / (len(losses_personnel) + 1) )


source:
  # Example a bar plot.
  start,end = 80,87
  losses_personnel = daily_losses_personnel()[start:end+1]
  plt.bar([x for x in range(start,end+1)],losses_personnel)
  print("Median:",round(sum(losses_personnel) / (len(losses_personnel) + 1)))

source_raw:
  # Example a bar plot.
  start,end = 80,87
  losses_personnel = daily_losses_personnel()[start:end+1]
  plt.bar([x for x in range(start,end+1)],losses_personnel)
  print("Median:",round(sum(losses_personnel) / (len(losses_personnel) + 1)))


source:
  # Example a bar plot.
  start,end = 2,93
  losses_personnel = daily_losses_personnel()[start:end+1]
  plt.bar([x for x in range(start,end+1)],losses_personnel)
  print("Median:",round(sum(losses_personnel) / (len(losses_personnel) + 1)))

source_raw:
  # Example a bar plot.
  start,end = 2,93
  losses_personnel = daily_losses_personnel()[start:end+1]
  plt.bar([x for x in range(start,end+1)],losses_personnel)
  print("Median:",round(sum(losses_personnel) / (len(losses_personnel) + 1)))


source:
  # Example a bar plot.
  start,end = 2,92
  losses_personnel = daily_losses_personnel()[start:end+1]
  plt.bar([x for x in range(start,end+1)],losses_personnel)
  print("Median:",round(sum(losses_personnel) / (len(losses_personnel) + 1)))

source_raw:
  # Example a bar plot.
  start,end = 2,92
  losses_personnel = daily_losses_personnel()[start:end+1]
  plt.bar([x for x in range(start,end+1)],losses_personnel)
  print("Median:",round(sum(losses_personnel) / (len(losses_personnel) + 1)))


source:
  # Example a bar plot.
  start,end = 20,30
  losses_personnel = daily_losses_personnel()[start:end+1]
  plt.bar([x for x in range(start,end+1)],losses_personnel)
  print("Median:",round(sum(losses_personnel) / (len(losses_personnel) + 1)))

source_raw:
  # Example a bar plot.
  start,end = 20,30
  losses_personnel = daily_losses_personnel()[start:end+1]
  plt.bar([x for x in range(start,end+1)],losses_personnel)
  print("Median:",round(sum(losses_personnel) / (len(losses_personnel) + 1)))


source:
  # Example a bar plot.
  start,end = 1,14
  losses_personnel = daily_losses_personnel()[start:end+1]
  plt.bar([x for x in range(start,end+1)],losses_personnel)
  print("Median:",round(sum(losses_personnel) / (len(losses_personnel) + 1)))

source_raw:
  # Example a bar plot.
  start,end = 1,14
  losses_personnel = daily_losses_personnel()[start:end+1]
  plt.bar([x for x in range(start,end+1)],losses_personnel)
  print("Median:",round(sum(losses_personnel) / (len(losses_personnel) + 1)))


source:
  # Example a bar plot.
  start,end = 15,30
  losses_personnel = daily_losses_personnel()[start:end+1]
  plt.bar([x for x in range(start,end+1)],losses_personnel)
  print("Median:",round(sum(losses_personnel) / (len(losses_personnel) + 1)))

source_raw:
  # Example a bar plot.
  start,end = 15,30
  losses_personnel = daily_losses_personnel()[start:end+1]
  plt.bar([x for x in range(start,end+1)],losses_personnel)
  print("Median:",round(sum(losses_personnel) / (len(losses_personnel) + 1)))


source:
  # Example a bar plot.
  start,end = 40,50
  losses_personnel = daily_losses_personnel()[start:end+1]
  plt.bar([x for x in range(start,end+1)],losses_personnel)
  print("Median:",round(sum(losses_personnel) / (len(losses_personnel) + 1)))

source_raw:
  # Example a bar plot.
  start,end = 40,50
  losses_personnel = daily_losses_personnel()[start:end+1]
  plt.bar([x for x in range(start,end+1)],losses_personnel)
  print("Median:",round(sum(losses_personnel) / (len(losses_personnel) + 1)))


source:
[cell repeats an earlier one in this file: 298 characters]

source_raw:
  %%bash 
  curl -O https://raw.githubusercontent.com/PetroIvaniuk/2022-Ukraine-Russia-War-Dataset/main/data/russia_losses_personnel.json
  curl -O https://raw.githubusercontent.com/PetroIvaniuk/2022-Ukraine-Russia-War-Dataset/main/data/russia_losses_equipment.json


source:
  def daily_losses_equipment(fieldname:str):
      equipment_losses = []
      with open('russia_losses_equipment.json') as file:
          data = json.load()
      for a,b in zip(data,data[1:]):
          equipment_losses.append(b[fieldname] - a[fieldname])
      return equipment_losses

source_raw:
  def daily_losses_equipment(fieldname:str):
      equipment_losses = []
      with open('russia_losses_equipment.json') as file:
          data = json.load()
      for a,b in zip(data,data[1:]):
          equipment_losses.append(b[fieldname] - a[fieldname])
      return equipment_losses


source:
  # Daily losses equipment 
  start,end = 40,50
  losses_equimpment = daily_losses_equipment("tank")
  plt.bar([x for x in rnge(start,end+1)],losses_equimpment)
  print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))

source_raw:
  # Daily losses equipment 
  start,end = 40,50
  losses_equimpment = daily_losses_equipment("tank")
  plt.bar([x for x in rnge(start,end+1)],losses_equimpment)
  print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))


source:
  def daily_losses_equipment(fieldname:str):
      equipment_losses = []
      with open('russia_losses_equipment.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          equipment_losses.append(b[fieldname] - a[fieldname])
      return equipment_losses

source_raw:
  def daily_losses_equipment(fieldname:str):
      equipment_losses = []
      with open('russia_losses_equipment.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          equipment_losses.append(b[fieldname] - a[fieldname])
      return equipment_losses


source:
  # Daily losses equipment 
  start,end = 40,50
  losses_equimpment = daily_losses_equipment("tank")
  plt.bar([x for x in range(start,end+1)],losses_equimpment)
  print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))

source_raw:
  # Daily losses equipment 
  start,end = 40,50
  losses_equimpment = daily_losses_equipment("tank")
  plt.bar([x for x in range(start,end+1)],losses_equimpment)
  print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))


source:
  # Daily losses equipment 
  start,end = 40,50
  losses_equimpment = daily_losses_equipment("tank")[start:end+1]
  plt.bar([x for x in range(start,end+1)],losses_equimpment)
  print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))

source_raw:
  # Daily losses equipment 
  start,end = 40,50
  losses_equimpment = daily_losses_equipment("tank")[start:end+1]
  plt.bar([x for x in range(start,end+1)],losses_equimpment)
  print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))


source:
  # Daily losses equipment 
  start,end = 1,14
  losses_equimpment = daily_losses_equipment("tank")[start:end+1]
  plt.bar([x for x in range(start,end+1)],losses_equimpment)
  print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))

source_raw:
  # Daily losses equipment 
  start,end = 1,14
  losses_equimpment = daily_losses_equipment("tank")[start:end+1]
  plt.bar([x for x in range(start,end+1)],losses_equimpment)
  print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))


source:
  # Daily losses equipment 
  start,end = 70,77
  losses_equimpment = daily_losses_equipment("tank")[start:end+1]
  plt.bar([x for x in range(start,end+1)],losses_equimpment)
  print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))

source_raw:
  # Daily losses equipment 
  start,end = 70,77
  losses_equimpment = daily_losses_equipment("tank")[start:end+1]
  plt.bar([x for x in range(start,end+1)],losses_equimpment)
  print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))


source:
  # Daily losses equipment 
  start,end = 70,77
  losses_equimpment = daily_losses_equipment("tank")[start-1:end+1]
  plt.bar([x for x in range(start,end+1)],losses_equimpment)
  print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))

source_raw:
  # Daily losses equipment 
  start,end = 70,77
  losses_equimpment = daily_losses_equipment("tank")[start-1:end+1]
  plt.bar([x for x in range(start,end+1)],losses_equimpment)
  print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))


source:
  # Daily losses equipment 
  start,end = 70,77
  losses_equimpment = daily_losses_equipment("tank")[start:end]
  plt.bar([x for x in range(start,end+1)],losses_equimpment)
  print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))

source_raw:
  # Daily losses equipment 
  start,end = 70,77
  losses_equimpment = daily_losses_equipment("tank")[start:end]
  plt.bar([x for x in range(start,end+1)],losses_equimpment)
  print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))


source:
  def daily_losses_equipment(fieldname:str):
      equipment_losses = []
      with open('russia_losses_equipment.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          equipment_losses.append(abs(a[fieldname] - b[fieldname]))
      return equipment_losses

source_raw:
  def daily_losses_equipment(fieldname:str):
      equipment_losses = []
      with open('russia_losses_equipment.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          equipment_losses.append(abs(a[fieldname] - b[fieldname]))
      return equipment_losses


source:
  # Daily losses equipment 
  start,end = 70,77
  losses_equimpment = daily_losses_equipment("tank")[start:end+1]
  print(losses_equimpment)
  plt.bar([x for x in range(start,end+1)],losses_equimpment)
  print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))

source_raw:
  # Daily losses equipment 
  start,end = 70,77
  losses_equimpment = daily_losses_equipment("tank")[start:end+1]
  print(losses_equimpment)
  plt.bar([x for x in range(start,end+1)],losses_equimpment)
  print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))


source:
  # Daily losses equipment 
  start,end = 70,77
  losses_equimpment = daily_losses_equipment("tank")[start:end+1]
  print(losses_equimpment)
  plt.bar([x for x in range(start,end)],losses_equimpment)
  print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))

source_raw:
  # Daily losses equipment 
  start,end = 70,77
  losses_equimpment = daily_losses_equipment("tank")[start:end+1]
  print(losses_equimpment)
  plt.bar([x for x in range(start,end)],losses_equimpment)
  print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))


source:
  # Daily losses equipment 
  start,end = 70,77
  losses_equimpment = daily_losses_equipment("tank")[start:end]
  print(losses_equimpment)
  plt.bar([x for x in range(start,end)],losses_equimpment)
  print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))

source_raw:
  # Daily losses equipment 
  start,end = 70,77
  losses_equimpment = daily_losses_equipment("tank")[start:end]
  print(losses_equimpment)
  plt.bar([x for x in range(start,end)],losses_equimpment)
  print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))


source:
  # Daily losses equipment 
  start,end = 70,77
  losses_equimpment = daily_losses_equipment("tank")[start:end]
  print(losses_equimpment)
  #print(losses_equimpment)
  #plt.bar([x for x in range(start,end)],losses_equimpment)
  #print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))

source_raw:
  # Daily losses equipment 
  start,end = 70,77
  losses_equimpment = daily_losses_equipment("tank")[start:end]
  print(losses_equimpment)
  #print(losses_equimpment)
  #plt.bar([x for x in range(start,end)],losses_equimpment)
  #print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))


source:
  # Daily losses equipment 
  start,end = 70,77
  losses_equimpment = daily_losses_equipment("tank")
  print(losses_equimpment)
  #print(losses_equimpment)
  #plt.bar([x for x in range(start,end)],losses_equimpment)
  #print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))

source_raw:
  # Daily losses equipment 
  start,end = 70,77
  losses_equimpment = daily_losses_equipment("tank")
  print(losses_equimpment)
  #print(losses_equimpment)
  #plt.bar([x for x in range(start,end)],losses_equimpment)
  #print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))


source:
  # Daily losses equipment 
  start,end = 70,77
  losses_equimpment = daily_losses_equipment("tank")
  print(losses_equimpment[71])
  #print(losses_equimpment)
  #plt.bar([x for x in range(start,end)],losses_equimpment)
  #print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))

source_raw:
  # Daily losses equipment 
  start,end = 70,77
  losses_equimpment = daily_losses_equipment("tank")
  print(losses_equimpment[71])
  #print(losses_equimpment)
  #plt.bar([x for x in range(start,end)],losses_equimpment)
  #print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))


source:
  # Daily losses equipment 
  start,end = 70,77
  losses_equimpment = daily_losses_equipment("tank")
  print(losses_equimpment[70])
  #print(losses_equimpment)
  #plt.bar([x for x in range(start,end)],losses_equimpment)
  #print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))

source_raw:
  # Daily losses equipment 
  start,end = 70,77
  losses_equimpment = daily_losses_equipment("tank")
  print(losses_equimpment[70])
  #print(losses_equimpment)
  #plt.bar([x for x in range(start,end)],losses_equimpment)
  #print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))


source:
  # Daily losses equipment 
  start,end = 70,77
  losses_equimpment = daily_losses_equipment("tank")
  print(losses_equimpment[0])
  #print(losses_equimpment)
  #plt.bar([x for x in range(start,end)],losses_equimpment)
  #print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))

source_raw:
  # Daily losses equipment 
  start,end = 70,77
  losses_equimpment = daily_losses_equipment("tank")
  print(losses_equimpment[0])
  #print(losses_equimpment)
  #plt.bar([x for x in range(start,end)],losses_equimpment)
  #print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))


source:
  # Daily losses equipment 
  start,end = 70,77
  losses_equimpment = daily_losses_equipment("tank")
  print(losses_equimpment[1])
  #print(losses_equimpment)
  #plt.bar([x for x in range(start,end)],losses_equimpment)
  #print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))

source_raw:
  # Daily losses equipment 
  start,end = 70,77
  losses_equimpment = daily_losses_equipment("tank")
  print(losses_equimpment[1])
  #print(losses_equimpment)
  #plt.bar([x for x in range(start,end)],losses_equimpment)
  #print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))


source:
  def daily_losses_equipment(fieldname:str):
      equipment_losses = []
      with open('russia_losses_equipment.json','r') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          equipment_losses.append(b[fieldname] - a[fieldname])
      return equipment_losses

source_raw:
  def daily_losses_equipment(fieldname:str):
      equipment_losses = []
      with open('russia_losses_equipment.json','r') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          equipment_losses.append(b[fieldname] - a[fieldname])
      return equipment_losses


source:
  # Daily losses equipment 
  start,end = 70,77
  losses_equimpment = daily_losses_equipment("tank")
  print(losses_equimpment[start])
  #print(losses_equimpment)
  #plt.bar([x for x in range(start,end)],losses_equimpment)
  #print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))

source_raw:
  # Daily losses equipment 
  start,end = 70,77
  losses_equimpment = daily_losses_equipment("tank")
  print(losses_equimpment[start])
  #print(losses_equimpment)
  #plt.bar([x for x in range(start,end)],losses_equimpment)
  #print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))


source:
  def daily_losses_equipment(fieldname:str,start:int,end:int):
      equipment_losses = []
      with open('russia_losses_equipment.json','r') as file:
          data = json.load(file)[start:end+1]
      for a,b in zip(data,data[1:]):
          equipment_losses.append(b[fieldname] - a[fieldname])
      return equipment_losses

source_raw:
  def daily_losses_equipment(fieldname:str,start:int,end:int):
      equipment_losses = []
      with open('russia_losses_equipment.json','r') as file:
          data = json.load(file)[start:end+1]
      for a,b in zip(data,data[1:]):
          equipment_losses.append(b[fieldname] - a[fieldname])
      return equipment_losses


source:
  # Daily losses equipment 
  start,end = 70,77
  losses_equimpment = daily_losses_equipment("tank",start,end)
  print(losses_equimpment)
  plt.bar([x for x in range(start,end)],losses_equimpment)
  print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))

source_raw:
  # Daily losses equipment 
  start,end = 70,77
  losses_equimpment = daily_losses_equipment("tank",start,end)
  print(losses_equimpment)
  plt.bar([x for x in range(start,end)],losses_equimpment)
  print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))


source:
  # Daily losses personnel a bar plot.
  start,end = 40,50
  losses_personnel = daily_losses_personnel()[start:end+1]
  plt.bar([x for x in range(start,end+1)],losses_personnel)
  print("Median:",round(sum(losses_personnel) / (len(losses_personnel) + 1)))

source_raw:
  # Daily losses personnel a bar plot.
  start,end = 40,50
  losses_personnel = daily_losses_personnel()[start:end+1]
  plt.bar([x for x in range(start,end+1)],losses_personnel)
  print("Median:",round(sum(losses_personnel) / (len(losses_personnel) + 1)))


source:
  def daily_losses_equipment(fieldname:str,start:int,end:int):
      equipment_losses = []
      with open('russia_losses_equipment.json','r') as file:
          data = json.load(file)[start:end+1]
      print(data)
      for a,b in zip(data,data[1:]):
          equipment_losses.append(b[fieldname] - a[fieldname])
      return equipment_losses

source_raw:
  def daily_losses_equipment(fieldname:str,start:int,end:int):
      equipment_losses = []
      with open('russia_losses_equipment.json','r') as file:
          data = json.load(file)[start:end+1]
      print(data)
      for a,b in zip(data,data[1:]):
          equipment_losses.append(b[fieldname] - a[fieldname])
      return equipment_losses


source:
  def daily_losses_equipment(fieldname:str,start:int,end:int):
      equipment_losses = []
      with open('russia_losses_equipment.json','r') as file:
          data = json.load(file)[start-2:end+1]
      print(data)
      for a,b in zip(data,data[1:]):
          equipment_losses.append(b[fieldname] - a[fieldname])
      return equipment_losses

source_raw:
  def daily_losses_equipment(fieldname:str,start:int,end:int):
      equipment_losses = []
      with open('russia_losses_equipment.json','r') as file:
          data = json.load(file)[start-2:end+1]
      print(data)
      for a,b in zip(data,data[1:]):
          equipment_losses.append(b[fieldname] - a[fieldname])
      return equipment_losses


source:
  # Daily losses equipment 
  start,end = 70,77
  losses_equimpment = daily_losses_equipment("tank",start,end)
  print(losses_equimpment)
  plt.bar([x for x in range(start,end+1)],losses_equimpment)
  print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))

source_raw:
  # Daily losses equipment 
  start,end = 70,77
  losses_equimpment = daily_losses_equipment("tank",start,end)
  print(losses_equimpment)
  plt.bar([x for x in range(start,end+1)],losses_equimpment)
  print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))


source:
  # Daily losses equipment 
  start,end = 70,77
  losses_equimpment = daily_losses_equipment("tank",start,end)
  print(losses_equimpment)
  plt.bar([x for x in range(start-2,end)],losses_equimpment)
  print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))

source_raw:
  # Daily losses equipment 
  start,end = 70,77
  losses_equimpment = daily_losses_equipment("tank",start,end)
  print(losses_equimpment)
  plt.bar([x for x in range(start-2,end)],losses_equimpment)
  print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))


source:
  # Daily losses equipment 
  start,end = 70,77
  losses_equimpment = daily_losses_equipment("tank",start,end)
  print(losses_equimpment)
  plt.bar([x for x in range(start-1,end)],losses_equimpment)
  print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))

source_raw:
  # Daily losses equipment 
  start,end = 70,77
  losses_equimpment = daily_losses_equipment("tank",start,end)
  print(losses_equimpment)
  plt.bar([x for x in range(start-1,end)],losses_equimpment)
  print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))


source:
  def daily_losses_equipment(fieldname:str,start:int,end:int):
      equipment_losses = []
      with open('russia_losses_equipment.json','r') as file:
          data = json.load(file)[start-2:end]
      print(data)
      for a,b in zip(data,data[1:]):
          equipment_losses.append(b[fieldname] - a[fieldname])
      return equipment_losses

source_raw:
  def daily_losses_equipment(fieldname:str,start:int,end:int):
      equipment_losses = []
      with open('russia_losses_equipment.json','r') as file:
          data = json.load(file)[start-2:end]
      print(data)
      for a,b in zip(data,data[1:]):
          equipment_losses.append(b[fieldname] - a[fieldname])
      return equipment_losses


source:
  def daily_losses_equipment(fieldname:str,start:int,end:int):
      equipment_losses = []
      with open('russia_losses_equipment.json','r') as file:
          data = json.load(file)[start-2:end-2]
      print(data)
      for a,b in zip(data,data[1:]):
          equipment_losses.append(b[fieldname] - a[fieldname])
      return equipment_losses

source_raw:
  def daily_losses_equipment(fieldname:str,start:int,end:int):
      equipment_losses = []
      with open('russia_losses_equipment.json','r') as file:
          data = json.load(file)[start-2:end-2]
      print(data)
      for a,b in zip(data,data[1:]):
          equipment_losses.append(b[fieldname] - a[fieldname])
      return equipment_losses


source:
  # Daily losses equipment 
  start,end = 70,77
  losses_equimpment = daily_losses_equipment("tank",start,end)
  print(losses_equimpment)
  plt.bar([x for x in range(start-2,end-2)],losses_equimpment)
  print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))

source_raw:
  # Daily losses equipment 
  start,end = 70,77
  losses_equimpment = daily_losses_equipment("tank",start,end)
  print(losses_equimpment)
  plt.bar([x for x in range(start-2,end-2)],losses_equimpment)
  print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))


source:
  # Daily losses equipment 
  start,end = 70,77
  losses_equimpment = daily_losses_equipment("tank",start,end)
  print(losses_equimpment)
  plt.bar([x for x in range(start,end-2)],losses_equimpment)
  print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))

source_raw:
  # Daily losses equipment 
  start,end = 70,77
  losses_equimpment = daily_losses_equipment("tank",start,end)
  print(losses_equimpment)
  plt.bar([x for x in range(start,end-2)],losses_equimpment)
  print("Median:",round(sum(losses_equimpment) / (len(losses_equimpment)  + 1)))


source:
  class User(Model):
      user_name = TextField()
      user_id   = IntegerField()
      class Meta:
          database = db
          db_table = "User"
          

source_raw:
  class User(Model):
      user_name = TextField()
      user_id   = IntegerField()
      class Meta:
          database = db
          db_table = "User"
          


source:
  def user_exist(user_id:int) -> bool:
      return User.select().where(Member.user_id == user_id).exists()
      

source_raw:
  def user_exist(user_id:int) -> bool:
      return User.select().where(Member.user_id == user_id).exists()
      


source:
  def user_exist(user_id:int) -> bool:
      return User.select().where(User.user_id == user_id).exists()
      

source_raw:
  def user_exist(user_id:int) -> bool:
      return User.select().where(User.user_id == user_id).exists()
      


source:
  students = Table(
     'students', meta, 
     Column('id', Integer, primary_key = True), 
     Column('name', String), 
     Column('lastname', String), 
  )

source_raw:
  students = Table(
     'students', meta, 
     Column('id', Integer, primary_key = True), 
     Column('name', String), 
     Column('lastname', String), 
  )


source:
  def parse_arguments(text:str,is_replied=False) -> Union[Arguments,None]:
      text_list = text.split()
      
      reason = None
      user_name = None
      
      if (len(text_list) > 2):reason = ' '.join(text_list[2:])
      if (not is_replied):

source_raw:
  def parse_arguments(text:str,is_replied=False) -> Union[Arguments,None]:
      text_list = text.split()
      
      reason = None
      user_name = None
      
      if (len(text_list) > 2):reason = ' '.join(text_list[2:])
      if (not is_replied):


source:
  def parse_arguments(text:str,is_reply=False) -> Union[Arguments,None]:
      text_list = text.split()
      

source_raw:
  def parse_arguments(text:str,is_reply=False) -> Union[Arguments,None]:
      text_list = text.split()
      


source:
  (df.loc[df['date'].dt.year.between(2016, 2017), 'date']
           .dt.year
           .value_counts()
           .sort_index()
           .plot(kind="bar")
  )

source_raw:
  (df.loc[df['date'].dt.year.between(2016, 2017), 'date']
           .dt.year
           .value_counts()
           .sort_index()
           .plot(kind="bar")
  )


source:
  for month in df_month['date'].unique():
      date = df[df["date"] == month]
      result.append(len(month))

source_raw:
  for month in df_month['date'].unique():
      date = df[df["date"] == month]
      result.append(len(month))


source:
  for month in df_month['date'].unique():
      #date = df[df["date"] == month]
      result.append(len(month))

source_raw:
  for month in df_month['date'].unique():
      #date = df[df["date"] == month]
      result.append(len(month))


source:
  i,j = 0,0
  for year in test:
      for month in year:
          result[i][j] = len(month)
          #print(len(month))
          j += 1
      i += 1

source_raw:
  i,j = 0,0
  for year in test:
      for month in year:
          result[i][j] = len(month)
          #print(len(month))
          j += 1
      i += 1


source:
  #for month in df_month['date'].unique():
      #date = df[df["date"] == month]
  #    result.append(len(month))

source_raw:
  #for month in df_month['date'].unique():
      #date = df[df["date"] == month]
  #    result.append(len(month))


source:
  i = 0
  for year in test:
      #for month in year:
      result[i].append(len(month))
      print(i)
      i += 1

source_raw:
  i = 0
  for year in test:
      #for month in year:
      result[i].append(len(month))
      print(i)
      i += 1


source:
  i = 0
  for year in test:
      #for month in year:
      #result[i].append(len(month))
      print(i)
      i += 1

source_raw:
  i = 0
  for year in test:
      #for month in year:
      #result[i].append(len(month))
      print(i)
      i += 1


source:
  i,j = 0,0
  for year in test:
      for month in year:
          result[i][j] = len(month)
          j += 1
      i += 1

source_raw:
  i,j = 0,0
  for year in test:
      for month in year:
          result[i][j] = len(month)
          j += 1
      i += 1


source:
  i,j = 0,0
  for year in test:
      for month in year:
          result[j][i] = len(month)
          j += 1
      i += 1

source_raw:
  i,j = 0,0
  for year in test:
      for month in year:
          result[j][i] = len(month)
          j += 1
      i += 1


source:
  result = []
  i,j = 0,0
  for year in test:
      for month in year:
          result[i][j] = len(month)
          j += 1
      i += 1

source_raw:
  result = []
  i,j = 0,0
  for year in test:
      for month in year:
          result[i][j] = len(month)
          j += 1
      i += 1


source:
  result = []
  i = 0
  for year in test:
      for month in year:
          result[i].append(len(month))
      i += 1
      

source_raw:
  result = []
  i = 0
  for year in test:
      for month in year:
          result[i].append(len(month))
      i += 1
      


source:
  result = []
  i,j = 0
  for year in test:
      result[j] = []
      for month in year:
          result[i].append(len(month))
          i += 1
      j += 1
      

source_raw:
  result = []
  i,j = 0
  for year in test:
      result[j] = []
      for month in year:
          result[i].append(len(month))
          i += 1
      j += 1
      


source:
  df = pd.read_csv("dataset.csv")
  #df.index = pd.to_datetime(df["date"])
  df["date"] = pd.to_datetime(df["date"])
  df.head()

source_raw:
  df = pd.read_csv("dataset.csv")
  #df.index = pd.to_datetime(df["date"])
  df["date"] = pd.to_datetime(df["date"])
  df.head()


source:
  class NeuralNetwork:
      def __init__(self,input_nodes,hidden_nodes,output_nodes,learning_rate):
          self.inodes = input_nodes
          self.hnodes = hidden_nodes
          self.onodes = output_nodes
          
          self.lr = learning_rate
      def train():
          pass
      def query():
          pass

source_raw:
  class NeuralNetwork:
      def __init__(self,input_nodes,hidden_nodes,output_nodes,learning_rate):
          self.inodes = input_nodes
          self.hnodes = hidden_nodes
          self.onodes = output_nodes
          
          self.lr = learning_rate
      def train():
          pass
      def query():
          pass


source:
  input_nodes = 3
  hidden_nodes = 3
  otput_nodes = 3

  learning_rate = 0.3

  n = NeuralNetwork(input_nodes,hidden_nodes,output_nodes.learning_rate)

source_raw:
  input_nodes = 3
  hidden_nodes = 3
  otput_nodes = 3

  learning_rate = 0.3

  n = NeuralNetwork(input_nodes,hidden_nodes,output_nodes.learning_rate)


source:
  input_nodes = 3
  hidden_nodes = 3
  output_nodes = 3

  learning_rate = 0.3

  n = NeuralNetwork(input_nodes,hidden_nodes,output_nodes.learning_rate)

source_raw:
  input_nodes = 3
  hidden_nodes = 3
  output_nodes = 3

  learning_rate = 0.3

  n = NeuralNetwork(input_nodes,hidden_nodes,output_nodes.learning_rate)


source:
  input_nodes = 3
  hidden_nodes = 3
  output_nodes = 3

  learning_rate = 0.3

  n = NeuralNetwork(input_nodes,hidden_nodes,output_nodes,learning_rate)

source_raw:
  input_nodes = 3
  hidden_nodes = 3
  output_nodes = 3

  learning_rate = 0.3

  n = NeuralNetwork(input_nodes,hidden_nodes,output_nodes,learning_rate)


source:
  class NeuralNetwork:
      def __init__(self,input_nodes,hidden_nodes,output_nodes,learning_rate):
          # Задаем количесво узлов нейронной сети
          self.input_nodes = input_nodes
          self.hidden_nodes = hidden_nodes
          self.output_nodes = output_nodes
          

source_raw:
  class NeuralNetwork:
      def __init__(self,input_nodes,hidden_nodes,output_nodes,learning_rate):
          # Задаем количесво узлов нейронной сети
          self.input_nodes = input_nodes
          self.hidden_nodes = hidden_nodes
          self.output_nodes = output_nodes
          


source:
  class NeuralNetwork:
      def __init__(self,input_nodes,hidden_nodes,output_nodes,learning_rate):
          # Задаем количесво узлов нейронной сети
          self.input_nodes = input_nodes
          self.hidden_nodes = hidden_nodes
          self.output_nodes = output_nodes
          
          self.weights_input = numpy.random.normal(0.0,pow(self.hidden_nodes,-0.5),(self.hidden_nodes,self.input_nodes))
          self.weights_output = numpy.random.normal(0.0,pow(self.output_nodes,-0.5),(self.output_nodes,self.hidden_nodes))

source_raw:
  class NeuralNetwork:
      def __init__(self,input_nodes,hidden_nodes,output_nodes,learning_rate):
          # Задаем количесво узлов нейронной сети
          self.input_nodes = input_nodes
          self.hidden_nodes = hidden_nodes
          self.output_nodes = output_nodes
          
          self.weights_input = numpy.random.normal(0.0,pow(self.hidden_nodes,-0.5),(self.hidden_nodes,self.input_nodes))
          self.weights_output = numpy.random.normal(0.0,pow(self.output_nodes,-0.5),(self.output_nodes,self.hidden_nodes))


source:
  class NeuralNetwork:
      def __init__(self,input_nodes,hidden_nodes,output_nodes,learning_rate):
          # Задаем количесво узлов нейронной сети
          self.input_nodes = input_nodes
          self.hidden_nodes = hidden_nodes
          self.output_nodes = output_nodes
          
          # Генерируем случайные веса
          self.weights_input = numpy.random.normal(0.0,pow(self.hidden_nodes,-0.5),(self.hidden_nodes,self.input_nodes))
          self.weights_output = numpy.random.normal(0.0,pow(self.output_nodes,-0.5),(self.output_nodes,self.hidden_nodes))
          
          self.learning_rate = learning_rate
          
          self.sigmoid = lambda x:scipy.special.expit(x)
          
      def query(self,input_list):
          # Преобразовуем список входных значений в 2-мерный массив
          inputs = numpy.array(input_list,ndmin=2).T
          
          hidden_inputs = numpy.dot(self.weights_input,self.input_nodes)
          
          #hidden_outputs = self.

source_raw:
  class NeuralNetwork:
      def __init__(self,input_nodes,hidden_nodes,output_nodes,learning_rate):
          # Задаем количесво узлов нейронной сети
          self.input_nodes = input_nodes
          self.hidden_nodes = hidden_nodes
          self.output_nodes = output_nodes
          
          # Генерируем случайные веса
          self.weights_input = numpy.random.normal(0.0,pow(self.hidden_nodes,-0.5),(self.hidden_nodes,self.input_nodes))
          self.weights_output = numpy.random.normal(0.0,pow(self.output_nodes,-0.5),(self.output_nodes,self.hidden_nodes))
          
          self.learning_rate = learning_rate
          
          self.sigmoid = lambda x:scipy.special.expit(x)
          
      def query(self,input_list):
          # Преобразовуем список входных значений в 2-мерный массив
          inputs = numpy.array(input_list,ndmin=2).T
          
          hidden_inputs = numpy.dot(self.weights_input,self.input_nodes)
          
          #hidden_outputs = self.


source:
  class NeuralNetwork:
      def __init__(self,input_nodes,hidden_nodes,output_nodes,learning_rate):
          # Задаем количесво узлов нейронной сети
          self.input_nodes = input_nodes
          self.hidden_nodes = hidden_nodes
          self.output_nodes = output_nodes
          
          # Генерируем случайные веса
          self.weights_input = numpy.random.normal(0.0,pow(self.hidden_nodes,-0.5),(self.hidden_nodes,self.input_nodes))
          self.weights_output = numpy.random.normal(0.0,pow(self.output_nodes,-0.5),(self.output_nodes,self.hidden_nodes))
          
          self.learning_rate = learning_rate
          
          self.sigmoid = lambda x:scipy.special.expit(x)
      def train():
          pass
      def query(self,input_list):
          # Преобразовуем список входных значений в 2-мерный массив
          inputs = numpy.array(input_list,ndmin=2).T
          
          # Рассчишать входящие сигналы для скрытого слоя
          hidden_inputs = numpy.dot(self.weights_input,self.input_nodes)
          # Рассчитать исходящие сигналы для выходного слоя 
          hidden_outputs = self.sigmoid(hidden_inputs)
          
          final_inputs = numpy.dot(self.weights_output,hidden_outputs)
          
          return sigmoid(final_inputs)
          

source_raw:
  class NeuralNetwork:
      def __init__(self,input_nodes,hidden_nodes,output_nodes,learning_rate):
          # Задаем количесво узлов нейронной сети
          self.input_nodes = input_nodes
          self.hidden_nodes = hidden_nodes
          self.output_nodes = output_nodes
          
          # Генерируем случайные веса
          self.weights_input = numpy.random.normal(0.0,pow(self.hidden_nodes,-0.5),(self.hidden_nodes,self.input_nodes))
          self.weights_output = numpy.random.normal(0.0,pow(self.output_nodes,-0.5),(self.output_nodes,self.hidden_nodes))
          
          self.learning_rate = learning_rate
          
          self.sigmoid = lambda x:scipy.special.expit(x)
      def train():
          pass
      def query(self,input_list):
          # Преобразовуем список входных значений в 2-мерный массив
          inputs = numpy.array(input_list,ndmin=2).T
          
          # Рассчишать входящие сигналы для скрытого слоя
          hidden_inputs = numpy.dot(self.weights_input,self.input_nodes)
          # Рассчитать исходящие сигналы для выходного слоя 
          hidden_outputs = self.sigmoid(hidden_inputs)
          
          final_inputs = numpy.dot(self.weights_output,hidden_outputs)
          
          return sigmoid(final_inputs)
          


source:
  class NeuralNetwork:
      def __init__(self,input_nodes,hidden_nodes,output_nodes,learning_rate):
          # Задаем количесво узлов нейронной сети
          self.input_nodes = input_nodes
          self.hidden_nodes = hidden_nodes
          self.output_nodes = output_nodes
          
          # Генерируем случайные веса
          self.weights_input = numpy.random.normal(0.0,pow(self.hidden_nodes,-0.5),(self.hidden_nodes,self.input_nodes))
          self.weights_output = numpy.random.normal(0.0,pow(self.output_nodes,-0.5),(self.output_nodes,self.hidden_nodes))
          
          self.learning_rate = learning_rate
          
          self.sigmoid = lambda x:scipy.special.expit(x)
      def train(self,inputs_list,targets_list):
          # Преобразовать список входных данных в двумерный массив
          inputs = numpy.array(inputs_list,ndmin=2).T
          targets = numpy.array(targets_list,ndmin=2).T
          
          hidden_inputs = numpy.dot(self.weights_input,inputs)
          hidden_outputs = self.sigmoid(hidden_inputs)
          
          final_inputs = numpy.dot(self.weights_output,hidden_outputs)
          final_outputs = self.sigmoid(final_inputs)
          
          output_errors = targets_list - final_outputs
          hidden_errors = numpy.dot(self.weights_output.T,output_errors)
          
          self.weights_output += self.learning_rate * numpy.dot((output_errors * final_outputs * (1 - final_inputs)),numpy.transpose(inputs))
          self.weights_input  += self.learning_rate * numpy.dot((hidden_errors * hidden_outputs * (1 - hidden_outputs) ),numpy.transpose(inputs))
      def query(self,input_list):
          # Преобразовуем список входных значений в 2-мерный массив
          inputs = numpy.array(input_list,ndmin=2).T
          
          # Рассчишать входящие сигналы для скрытого слоя
          hidden_inputs = numpy.dot(self.weights_input,self.input_nodes)
          # Рассчитать исходящие сигналы для выходного слоя 
          hidden_outputs = self.sigmoid(hidden_inputs)
          
          final_inputs = numpy.dot(self.weights_output,hidden_outputs)
          
          return sigmoid(final_inputs)
          

source_raw:
  class NeuralNetwork:
      def __init__(self,input_nodes,hidden_nodes,output_nodes,learning_rate):
          # Задаем количесво узлов нейронной сети
          self.input_nodes = input_nodes
          self.hidden_nodes = hidden_nodes
          self.output_nodes = output_nodes
          
          # Генерируем случайные веса
          self.weights_input = numpy.random.normal(0.0,pow(self.hidden_nodes,-0.5),(self.hidden_nodes,self.input_nodes))
          self.weights_output = numpy.random.normal(0.0,pow(self.output_nodes,-0.5),(self.output_nodes,self.hidden_nodes))
          
          self.learning_rate = learning_rate
          
          self.sigmoid = lambda x:scipy.special.expit(x)
      def train(self,inputs_list,targets_list):
          # Преобразовать список входных данных в двумерный массив
          inputs = numpy.array(inputs_list,ndmin=2).T
          targets = numpy.array(targets_list,ndmin=2).T
          
          hidden_inputs = numpy.dot(self.weights_input,inputs)
          hidden_outputs = self.sigmoid(hidden_inputs)
          
          final_inputs = numpy.dot(self.weights_output,hidden_outputs)
          final_outputs = self.sigmoid(final_inputs)
          
          output_errors = targets_list - final_outputs
          hidden_errors = numpy.dot(self.weights_output.T,output_errors)
          
          self.weights_output += self.learning_rate * numpy.dot((output_errors * final_outputs * (1 - final_inputs)),numpy.transpose(inputs))
          self.weights_input  += self.learning_rate * numpy.dot((hidden_errors * hidden_outputs * (1 - hidden_outputs) ),numpy.transpose(inputs))
      def query(self,input_list):
          # Преобразовуем список входных значений в 2-мерный массив
          inputs = numpy.array(input_list,ndmin=2).T
          
          # Рассчишать входящие сигналы для скрытого слоя
          hidden_inputs = numpy.dot(self.weights_input,self.input_nodes)
          # Рассчитать исходящие сигналы для выходного слоя 
          hidden_outputs = self.sigmoid(hidden_inputs)
          
          final_inputs = numpy.dot(self.weights_output,hidden_outputs)
          
          return sigmoid(final_inputs)
          


source:
  get_ipython().run_cell_magic('bash', '', 'curl -O https://www.pjreddie.com/media/files/mnist_train.csv\ncurl -O https://www.pjreddie.com/media/files/mnist_test.csv\n')

source_raw:
  %%bash
  curl -O https://www.pjreddie.com/media/files/mnist_train.csv
  curl -O https://www.pjreddie.com/media/files/mnist_test.csv


source:
  get_ipython().run_cell_magic('bash', '', 'curl -O http://www.pjreddie.com/media/files/mnist_train.csv\ncurl -O http://www.pjreddie.com/media/files/mnist_test.csv\n')

source_raw:
  %%bash
  curl -O http://www.pjreddie.com/media/files/mnist_train.csv
  curl -O http://www.pjreddie.com/media/files/mnist_test.csv


source:
  get_ipython().run_cell_magic('bash', '', 'curl -O https://pjreddie.com/media/files/mnist_train.csv\ncurl -O https://pjreddie.com/media/files/mnist_test.csv\n')

source_raw:
  %%bash
  curl -O https://pjreddie.com/media/files/mnist_train.csv
  curl -O https://pjreddie.com/media/files/mnist_test.csv


source:
  mnist_dataset = open("mnist_train.csv","r")
  mnist_dataset = mnist_dataset.readlines()
  mnist_dataset.close()

source_raw:
  mnist_dataset = open("mnist_train.csv","r")
  mnist_dataset = mnist_dataset.readlines()
  mnist_dataset.close()


source:
  # Example
  example_values = mnist_dataset[0].split(",")
  image_array = numpy.asfarray(example_values[1:]).reshape((28,28))

source_raw:
  # Example
  example_values = mnist_dataset[0].split(",")
  image_array = numpy.asfarray(example_values[1:]).reshape((28,28))


source:
  # Example
  example_values = mnist_dataset[0].split(",")
  image_array = numpy.asfarray(example_values[1:]).reshape((28,28))
  plt.imshow(image_array,cmap="Greys",interpolation=None)

source_raw:
  # Example
  example_values = mnist_dataset[0].split(",")
  image_array = numpy.asfarray(example_values[1:]).reshape((28,28))
  plt.imshow(image_array,cmap="Greys",interpolation=None)


source:
  input_nodes = 784
  hidden_nodes = 100
  output_nodes = 100

  learning_rate = 0.3

  n = NeuralNetwork(input_nodes,hidden_nodes,output_nodes,learning_rate)

  for record in mnist_dataset:
      all_values = record.split(",")
      
      inputs = numpy.asfarray(all_values[1:] / 255.0 0.99) + 0.01
      
      targets = numpy.zeros(output_nodes) + 0.01
      targets[int(all_values[0])] = 0.99
      n.train(inputs,targets)

source_raw:
  input_nodes = 784
  hidden_nodes = 100
  output_nodes = 100

  learning_rate = 0.3

  n = NeuralNetwork(input_nodes,hidden_nodes,output_nodes,learning_rate)

  for record in mnist_dataset:
      all_values = record.split(",")
      
      inputs = numpy.asfarray(all_values[1:] / 255.0 0.99) + 0.01
      
      targets = numpy.zeros(output_nodes) + 0.01
      targets[int(all_values[0])] = 0.99
      n.train(inputs,targets)


source:
  input_nodes = 784
  hidden_nodes = 100
  output_nodes = 100

  learning_rate = 0.3

  n = NeuralNetwork(input_nodes,hidden_nodes,output_nodes,learning_rate)

  for record in mnist_dataset:
      all_values = record.split(",")
      
      inputs = numpy.asfarray(all_values[1:] / 255.0 0.99) + 0.0)
      
      targets = numpy.zeros(output_nodes) + 0.01
      targets[int(all_values[0])] = 0.99
      n.train(inputs,targets)

source_raw:
  input_nodes = 784
  hidden_nodes = 100
  output_nodes = 100

  learning_rate = 0.3

  n = NeuralNetwork(input_nodes,hidden_nodes,output_nodes,learning_rate)

  for record in mnist_dataset:
      all_values = record.split(",")
      
      inputs = numpy.asfarray(all_values[1:] / 255.0 0.99) + 0.0)
      
      targets = numpy.zeros(output_nodes) + 0.01
      targets[int(all_values[0])] = 0.99
      n.train(inputs,targets)


source:
  input_nodes = 784
  hidden_nodes = 100
  output_nodes = 100

  learning_rate = 0.3

  n = NeuralNetwork(input_nodes,hidden_nodes,output_nodes,learning_rate)

  for record in mnist_dataset:
      all_values = record.split(",")
      
      inputs = numpy.asfarray((all_values[1:] / 255.0 0.99) + 0.01
      
      targets = numpy.zeros(output_nodes) + 0.01
      targets[int(all_values[0])] = 0.99
      n.train(inputs,targets)

source_raw:
  input_nodes = 784
  hidden_nodes = 100
  output_nodes = 100

  learning_rate = 0.3

  n = NeuralNetwork(input_nodes,hidden_nodes,output_nodes,learning_rate)

  for record in mnist_dataset:
      all_values = record.split(",")
      
      inputs = numpy.asfarray((all_values[1:] / 255.0 0.99) + 0.01
      
      targets = numpy.zeros(output_nodes) + 0.01
      targets[int(all_values[0])] = 0.99
      n.train(inputs,targets)


source:
  input_nodes = 784
  hidden_nodes = 100
  output_nodes = 100

  learning_rate = 0.3

  n = NeuralNetwork(input_nodes,hidden_nodes,output_nodes,learning_rate)

  for record in mnist_dataset:
      all_values = record.split(",")
      
      inputs = numpy.asfarray(all_values[1:] / 255.0 * 0.99) + 0.01
      
      targets = numpy.zeros(output_nodes) + 0.01
      targets[int(all_values[0])] = 0.99
      n.train(inputs,targets)

source_raw:
  input_nodes = 784
  hidden_nodes = 100
  output_nodes = 100

  learning_rate = 0.3

  n = NeuralNetwork(input_nodes,hidden_nodes,output_nodes,learning_rate)

  for record in mnist_dataset:
      all_values = record.split(",")
      
      inputs = numpy.asfarray(all_values[1:] / 255.0 * 0.99) + 0.01
      
      targets = numpy.zeros(output_nodes) + 0.01
      targets[int(all_values[0])] = 0.99
      n.train(inputs,targets)


source:
  input_nodes = 784
  hidden_nodes = 100
  output_nodes = 100

  learning_rate = 0.3

  n = NeuralNetwork(input_nodes,hidden_nodes,output_nodes,learning_rate)

  for record in mnist_dataset:
      all_values = record.split(",")
      
      inputs = (numpy.asfarray(all_values[1:]) / 255.0 * 0.99) + 0.01
      
      targets = numpy.zeros(output_nodes) + 0.01
      targets[int(all_values[0])] = 0.99
      n.train(inputs,targets)

source_raw:
  input_nodes = 784
  hidden_nodes = 100
  output_nodes = 100

  learning_rate = 0.3

  n = NeuralNetwork(input_nodes,hidden_nodes,output_nodes,learning_rate)

  for record in mnist_dataset:
      all_values = record.split(",")
      
      inputs = (numpy.asfarray(all_values[1:]) / 255.0 * 0.99) + 0.01
      
      targets = numpy.zeros(output_nodes) + 0.01
      targets[int(all_values[0])] = 0.99
      n.train(inputs,targets)


source:
  class NeuralNetwork:
      def __init__(self,input_nodes,hidden_nodes,output_nodes,learning_rate):
          # Задаем количесво узлов нейронной сети
          self.input_nodes = input_nodes
          self.hidden_nodes = hidden_nodes
          self.output_nodes = output_nodes
          
          # Генерируем случайные веса
          self.weights_input = numpy.random.normal(0.0,pow(self.hidden_nodes,-0.5),(self.hidden_nodes,self.input_nodes))
          self.weights_output = numpy.random.normal(0.0,pow(self.output_nodes,-0.5),(self.output_nodes,self.hidden_nodes))
          
          self.learning_rate = learning_rate
          
          self.sigmoid = lambda x:scipy.special.expit(x)
      def train(self,inputs_list,targets_list):
          # Преобразовать список входных данных в двумерный массив
          inputs = numpy.array(inputs_list,ndmin=2).T
          targets = numpy.array(targets_list,ndmin=2).T
          
          hidden_inputs = numpy.dot(self.weights_input,inputs)
          hidden_outputs = self.sigmoid(hidden_inputs)
          
          final_inputs = numpy.dot(self.weights_output,hidden_outputs)
          final_outputs = self.sigmoid(final_inputs)
          
          output_errors = targets_list - final_outputs
          hidden_errors = numpy.dot(self.weights_output.T,output_errors)
          
          self.weights_output += self.learning_rate * numpy.dot( (output_errors * final_outputs *  (1 - final_inputs) ),numpy.transpose(inputs))
          self.weights_input  += self.learning_rate * numpy.dot( (hidden_errors * hidden_outputs * (1 - hidden_outputs) ),numpy.transpose(inputs))
      
      def query(self,input_list):
          # Преобразовуем список входных значений в 2-мерный массив
          inputs = numpy.array(input_list,ndmin=2).T
          
          # Рассчишать входящие сигналы для скрытого слоя
          hidden_inputs = numpy.dot(self.weights_input,self.input_nodes)
          # Рассчитать исходящие сигналы для выходного слоя 
          hidden_outputs = self.sigmoid(hidden_inputs)
          
          final_inputs = numpy.dot(self.weights_output,hidden_outputs)
          
          return sigmoid(final_inputs)
          

source_raw:
  class NeuralNetwork:
      def __init__(self,input_nodes,hidden_nodes,output_nodes,learning_rate):
          # Задаем количесво узлов нейронной сети
          self.input_nodes = input_nodes
          self.hidden_nodes = hidden_nodes
          self.output_nodes = output_nodes
          
          # Генерируем случайные веса
          self.weights_input = numpy.random.normal(0.0,pow(self.hidden_nodes,-0.5),(self.hidden_nodes,self.input_nodes))
          self.weights_output = numpy.random.normal(0.0,pow(self.output_nodes,-0.5),(self.output_nodes,self.hidden_nodes))
          
          self.learning_rate = learning_rate
          
          self.sigmoid = lambda x:scipy.special.expit(x)
      def train(self,inputs_list,targets_list):
          # Преобразовать список входных данных в двумерный массив
          inputs = numpy.array(inputs_list,ndmin=2).T
          targets = numpy.array(targets_list,ndmin=2).T
          
          hidden_inputs = numpy.dot(self.weights_input,inputs)
          hidden_outputs = self.sigmoid(hidden_inputs)
          
          final_inputs = numpy.dot(self.weights_output,hidden_outputs)
          final_outputs = self.sigmoid(final_inputs)
          
          output_errors = targets_list - final_outputs
          hidden_errors = numpy.dot(self.weights_output.T,output_errors)
          
          self.weights_output += self.learning_rate * numpy.dot( (output_errors * final_outputs *  (1 - final_inputs) ),numpy.transpose(inputs))
          self.weights_input  += self.learning_rate * numpy.dot( (hidden_errors * hidden_outputs * (1 - hidden_outputs) ),numpy.transpose(inputs))
      
      def query(self,input_list):
          # Преобразовуем список входных значений в 2-мерный массив
          inputs = numpy.array(input_list,ndmin=2).T
          
          # Рассчишать входящие сигналы для скрытого слоя
          hidden_inputs = numpy.dot(self.weights_input,self.input_nodes)
          # Рассчитать исходящие сигналы для выходного слоя 
          hidden_outputs = self.sigmoid(hidden_inputs)
          
          final_inputs = numpy.dot(self.weights_output,hidden_outputs)
          
          return sigmoid(final_inputs)
          


source:
  class NeuralNetwork:
      def __init__(self,input_nodes,hidden_nodes,output_nodes,learning_rate):
          # Задаем количесво узлов нейронной сети
          self.input_nodes = input_nodes
          self.hidden_nodes = hidden_nodes
          self.output_nodes = output_nodes
          
          # Генерируем случайные веса
          self.weights_input = numpy.random.normal(0.0,pow(self.hidden_nodes,-0.5),(self.hidden_nodes,self.input_nodes))
          self.weights_output = numpy.random.normal(0.0,pow(self.output_nodes,-0.5),(self.output_nodes,self.hidden_nodes))
          
          self.learning_rate = learning_rate
          
          self.sigmoid = lambda x:scipy.special.expit(x)
      def train(self,inputs_list,targets_list):
          # Преобразовать список входных данных в двумерный массив
          inputs = numpy.array(inputs_list,ndmin=2).T
          targets = numpy.array(targets_list,ndmin=2).T
          
          hidden_inputs = numpy.dot(self.weights_input,inputs)
          hidden_outputs = self.sigmoid(hidden_inputs)
          
          final_inputs = numpy.dot(self.weights_output,hidden_outputs)
          final_outputs = self.sigmoid(final_inputs)
          
          output_errors = targets_list - final_outputs
          hidden_errors = numpy.dot(self.weights_output.T,output_errors)
          
          self.weights_output += self.learning_rate * numpy.dot( (output_errors * final_outputs *  (1 - final_inputs) ),numpy.transpose(hidden_outputs))
          self.weights_input  += self.learning_rate * numpy.dot( (hidden_errors * hidden_outputs * (1 - hidden_outputs) ),numpy.transpose(inputs))
      
      def query(self,input_list):
          # Преобразовуем список входных значений в 2-мерный массив
          inputs = numpy.array(input_list,ndmin=2).T
          
          # Рассчишать входящие сигналы для скрытого слоя
          hidden_inputs = numpy.dot(self.weights_input,self.input_nodes)
          # Рассчитать исходящие сигналы для выходного слоя 
          hidden_outputs = self.sigmoid(hidden_inputs)
          
          final_inputs = numpy.dot(self.weights_output,hidden_outputs)
          
          return sigmoid(final_inputs)
          

source_raw:
  class NeuralNetwork:
      def __init__(self,input_nodes,hidden_nodes,output_nodes,learning_rate):
          # Задаем количесво узлов нейронной сети
          self.input_nodes = input_nodes
          self.hidden_nodes = hidden_nodes
          self.output_nodes = output_nodes
          
          # Генерируем случайные веса
          self.weights_input = numpy.random.normal(0.0,pow(self.hidden_nodes,-0.5),(self.hidden_nodes,self.input_nodes))
          self.weights_output = numpy.random.normal(0.0,pow(self.output_nodes,-0.5),(self.output_nodes,self.hidden_nodes))
          
          self.learning_rate = learning_rate
          
          self.sigmoid = lambda x:scipy.special.expit(x)
      def train(self,inputs_list,targets_list):
          # Преобразовать список входных данных в двумерный массив
          inputs = numpy.array(inputs_list,ndmin=2).T
          targets = numpy.array(targets_list,ndmin=2).T
          
          hidden_inputs = numpy.dot(self.weights_input,inputs)
          hidden_outputs = self.sigmoid(hidden_inputs)
          
          final_inputs = numpy.dot(self.weights_output,hidden_outputs)
          final_outputs = self.sigmoid(final_inputs)
          
          output_errors = targets_list - final_outputs
          hidden_errors = numpy.dot(self.weights_output.T,output_errors)
          
          self.weights_output += self.learning_rate * numpy.dot( (output_errors * final_outputs *  (1 - final_inputs) ),numpy.transpose(hidden_outputs))
          self.weights_input  += self.learning_rate * numpy.dot( (hidden_errors * hidden_outputs * (1 - hidden_outputs) ),numpy.transpose(inputs))
      
      def query(self,input_list):
          # Преобразовуем список входных значений в 2-мерный массив
          inputs = numpy.array(input_list,ndmin=2).T
          
          # Рассчишать входящие сигналы для скрытого слоя
          hidden_inputs = numpy.dot(self.weights_input,self.input_nodes)
          # Рассчитать исходящие сигналы для выходного слоя 
          hidden_outputs = self.sigmoid(hidden_inputs)
          
          final_inputs = numpy.dot(self.weights_output,hidden_outputs)
          
          return sigmoid(final_inputs)
          


source:
  def daily_losses_personnel() -> list:
      personnel_losses = []
      with open('russia_losses_personnel.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          print(f"{a} {b}")
          #personnel_losses.append(b['personnel'] - a['personnel'])
      return personnel_losses

source_raw:
  def daily_losses_personnel() -> list:
      personnel_losses = []
      with open('russia_losses_personnel.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          print(f"{a} {b}")
          #personnel_losses.append(b['personnel'] - a['personnel'])
      return personnel_losses


source:
  def daily_losses_personnel() -> list:
      personnel_losses = []
      with open('russia_losses_personnel.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[2:]):
          personnel_losses.append(b['personnel'] - a['personnel'])
      return personnel_losses

source_raw:
  def daily_losses_personnel() -> list:
      personnel_losses = []
      with open('russia_losses_personnel.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[2:]):
          personnel_losses.append(b['personnel'] - a['personnel'])
      return personnel_losses


source:
  def daily_losses_personnel() -> list:
      personnel_losses = []
      with open('russia_losses_personnel.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          personnel_losses.append(b['personnel'] - a['personnel'])
      return personnel_losses[1::1]

source_raw:
  def daily_losses_personnel() -> list:
      personnel_losses = []
      with open('russia_losses_personnel.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          personnel_losses.append(b['personnel'] - a['personnel'])
      return personnel_losses[1::1]


source:
  sum = 0
  losses = daily_losses_personnel()
  for loss in losses:
      sum += loss
  print(f"Median personnal losses:{sum/len(losses)}\n")

source_raw:
  sum = 0
  losses = daily_losses_personnel()
  for loss in losses:
      sum += loss
  print(f"Median personnal losses:{sum/len(losses)}\n")


source:
  sum = 0
  losses = daily_losses_personnel()
  for loss in losses:
      sum += loss
  print(f"Median personnal losses:{round(sum/len(losses))}\n")

source_raw:
  sum = 0
  losses = daily_losses_personnel()
  for loss in losses:
      sum += loss
  print(f"Median personnal losses:{round(sum/len(losses))}\n")


source:
  with open("russia_losses_equipment.json","r") as jsonfile:
      losses_equipment = json.dump(jsonfile)
      

source_raw:
  with open("russia_losses_equipment.json","r") as jsonfile:
      losses_equipment = json.dump(jsonfile)
      


source:
  with open("russia_losses_equipment.json","r") as jsonfile:
      losses_equipment = json.dumps(jsonfile)
      

source_raw:
  with open("russia_losses_equipment.json","r") as jsonfile:
      losses_equipment = json.dumps(jsonfile)
      


source:
  with open("russia_losses_equipment.json","r") as jsonfile:
      losses_equipment = json.load(jsofile)
      

source_raw:
  with open("russia_losses_equipment.json","r") as jsonfile:
      losses_equipment = json.load(jsofile)
      


source:
  with open("russia_losses_equipment.json","r") as jsonfile:
      losses_equipment = json.load(jsonfile)
      

source_raw:
  with open("russia_losses_equipment.json","r") as jsonfile:
      losses_equipment = json.load(jsonfile)
      


source:
  def daily_losses_personnel() -> list:
      personnel_losses = []
      with open('russia_losses_personnel.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          personnel_losses.append({"losses":b['personnel'] - a['personnel']})
      return personnel_losses[1::1]

source_raw:
  def daily_losses_personnel() -> list:
      personnel_losses = []
      with open('russia_losses_personnel.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          personnel_losses.append({"losses":b['personnel'] - a['personnel']})
      return personnel_losses[1::1]


source:
  sum = 0
  losses = daily_losses_personnel()
  for loss in losses:
      sum += loss["losses"]
  print(f"Median personnal losses:{round(sum/len(losses))}\n")

source_raw:
  sum = 0
  losses = daily_losses_personnel()
  for loss in losses:
      sum += loss["losses"]
  print(f"Median personnal losses:{round(sum/len(losses))}\n")


source:
  # Collect data
  get_ipython().run_line_magic('%bash', '')
  curl -O https://raw.githubusercontent.com/PetroIvaniuk/2022-Ukraine-Russia-War-Dataset/main/data/russia_losses_personnel.json
  curl -O https://raw.githubusercontent.com/PetroIvaniuk/2022-Ukraine-Russia-War-Dataset/main/data/russia_losses_equipment.json

source_raw:
  # Collect data
  %%bash 
  curl -O https://raw.githubusercontent.com/PetroIvaniuk/2022-Ukraine-Russia-War-Dataset/main/data/russia_losses_personnel.json
  curl -O https://raw.githubusercontent.com/PetroIvaniuk/2022-Ukraine-Russia-War-Dataset/main/data/russia_losses_equipment.json


source:
  def daily_losses_personnel() -> list:
      personnel_losses = []
      with open('russia_losses_personnel.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          personnel_losses.append({"losses":b['personnel'] - a['personnel']})
      return personnel_losses[1::1]
  def daily_losses_equipment() -> list:
      equipment_losses = []
      ignore = ["date","day"]
      with open('russia_losses_equipment.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          for key in a.keys():
              if not (key in ignore):
                  equipment_losses.append({key:b[key] - a[key]})
      return equipment_losses

source_raw:
  def daily_losses_personnel() -> list:
      personnel_losses = []
      with open('russia_losses_personnel.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          personnel_losses.append({"losses":b['personnel'] - a['personnel']})
      return personnel_losses[1::1]
  def daily_losses_equipment() -> list:
      equipment_losses = []
      ignore = ["date","day"]
      with open('russia_losses_equipment.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          for key in a.keys():
              if not (key in ignore):
                  equipment_losses.append({key:b[key] - a[key]})
      return equipment_losses


source:
  def daily_losses_personnel() -> list:
      personnel_losses = []
      with open('russia_losses_personnel.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          personnel_losses.append({"losses":b['personnel'] - a['personnel']})
      return personnel_losses[1::1]
  def daily_losses_equipment() -> list:
      equipment_losses = []
      ignore = ["date","day"]
      with open('russia_losses_equipment.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          for key in a.keys():
              if not (key in ignore):
                  print(type(b[key]))
                  equipment_losses.append({key:b[key] - a[key]})
      return equipment_losses

source_raw:
  def daily_losses_personnel() -> list:
      personnel_losses = []
      with open('russia_losses_personnel.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          personnel_losses.append({"losses":b['personnel'] - a['personnel']})
      return personnel_losses[1::1]
  def daily_losses_equipment() -> list:
      equipment_losses = []
      ignore = ["date","day"]
      with open('russia_losses_equipment.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          for key in a.keys():
              if not (key in ignore):
                  print(type(b[key]))
                  equipment_losses.append({key:b[key] - a[key]})
      return equipment_losses


source:
  def daily_losses_personnel() -> list:
      personnel_losses = []
      with open('russia_losses_personnel.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          personnel_losses.append({"losses":b['personnel'] - a['personnel']})
      return personnel_losses[1::1]
  def daily_losses_equipment() -> list:
      equipment_losses = []
      ignore = ["date","day"]
      with open('russia_losses_equipment.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          for key in a.keys():
              if not (key in ignore):
                  print(type(a[key]))
                  equipment_losses.append({key:b[key] - a[key]})
      return equipment_losses

source_raw:
  def daily_losses_personnel() -> list:
      personnel_losses = []
      with open('russia_losses_personnel.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          personnel_losses.append({"losses":b['personnel'] - a['personnel']})
      return personnel_losses[1::1]
  def daily_losses_equipment() -> list:
      equipment_losses = []
      ignore = ["date","day"]
      with open('russia_losses_equipment.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          for key in a.keys():
              if not (key in ignore):
                  print(type(a[key]))
                  equipment_losses.append({key:b[key] - a[key]})
      return equipment_losses


source:
  sum:float = 0.0
  losses = daily_losses_personnel()
  for loss in losses:
      sum += loss["losses"]
  print(f"Median personnal losses:{round(sum/len(losses))}\n")

source_raw:
  sum:float = 0.0
  losses = daily_losses_personnel()
  for loss in losses:
      sum += loss["losses"]
  print(f"Median personnal losses:{round(sum/len(losses))}\n")


source:
  sum:float = 0.0
  losses = daily_losses_personnel()
  for loss in losses:
      sum += float(loss["losses"])
  print(f"Median personnal losses:{round(sum/len(losses))}\n")

source_raw:
  sum:float = 0.0
  losses = daily_losses_personnel()
  for loss in losses:
      sum += float(loss["losses"])
  print(f"Median personnal losses:{round(sum/len(losses))}\n")


source:
  def daily_losses_personnel() -> list:
      personnel_losses = []
      with open('russia_losses_personnel.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          personnel_losses.append({"losses":b['personnel'] - a['personnel']})
      return personnel_losses[1::1]
  def daily_losses_equipment() -> list:
      equipment_losses = []
      ignore = ["date","day"]
      with open('russia_losses_equipment.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          for key in a.keys():
              if not (key in ignore):
                  print(key)
                  equipment_losses.append({key:b[key] - a[key]})
      return equipment_losses

source_raw:
  def daily_losses_personnel() -> list:
      personnel_losses = []
      with open('russia_losses_personnel.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          personnel_losses.append({"losses":b['personnel'] - a['personnel']})
      return personnel_losses[1::1]
  def daily_losses_equipment() -> list:
      equipment_losses = []
      ignore = ["date","day"]
      with open('russia_losses_equipment.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          for key in a.keys():
              if not (key in ignore):
                  print(key)
                  equipment_losses.append({key:b[key] - a[key]})
      return equipment_losses


source:
  def daily_losses_personnel() -> list:
      personnel_losses = []
      with open('russia_losses_personnel.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          personnel_losses.append({"losses":b['personnel'] - a['personnel']})
      return personnel_losses[1::1]
  def daily_losses_equipment() -> list:
      equipment_losses = []
      ignore = ["date","day"]
      with open('russia_losses_equipment.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          for key in a.keys():
              if not (key in ignore):
                  print(f"{a[key]} {b[key]}")
                  equipment_losses.append({key:b[key] - a[key]})
      return equipment_losses

source_raw:
  def daily_losses_personnel() -> list:
      personnel_losses = []
      with open('russia_losses_personnel.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          personnel_losses.append({"losses":b['personnel'] - a['personnel']})
      return personnel_losses[1::1]
  def daily_losses_equipment() -> list:
      equipment_losses = []
      ignore = ["date","day"]
      with open('russia_losses_equipment.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          for key in a.keys():
              if not (key in ignore):
                  print(f"{a[key]} {b[key]}")
                  equipment_losses.append({key:b[key] - a[key]})
      return equipment_losses


source:
  def daily_losses_personnel() -> list:
      personnel_losses = []
      with open('russia_losses_personnel.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          personnel_losses.append({"losses":b['personnel'] - a['personnel']})
      return personnel_losses[1::1]
  def daily_losses_equipment() -> list:
      equipment_losses = []
      ignore = ["date","day"]
      with open('russia_losses_equipment.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          for key in a.keys():
              if not (key in ignore):
                  if (type(a[key]) == "str") or (type(b[key]) == "str")
                  print(f"{a[key]} {b[key]}")
                  equipment_losses.append({key:b[key] - a[key]})
      return equipment_losses

source_raw:
  def daily_losses_personnel() -> list:
      personnel_losses = []
      with open('russia_losses_personnel.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          personnel_losses.append({"losses":b['personnel'] - a['personnel']})
      return personnel_losses[1::1]
  def daily_losses_equipment() -> list:
      equipment_losses = []
      ignore = ["date","day"]
      with open('russia_losses_equipment.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          for key in a.keys():
              if not (key in ignore):
                  if (type(a[key]) == "str") or (type(b[key]) == "str")
                  print(f"{a[key]} {b[key]}")
                  equipment_losses.append({key:b[key] - a[key]})
      return equipment_losses


source:
  def daily_losses_personnel() -> list:
      personnel_losses = []
      with open('russia_losses_personnel.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          personnel_losses.append({"losses":b['personnel'] - a['personnel']})
      return personnel_losses[1::1]
  def daily_losses_equipment() -> list:
      equipment_losses = []
      ignore = ["date","day"]
      with open('russia_losses_equipment.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          for key in a.keys():
              if not (key in ignore):
                  if (type(a[key]) == "str") or (type(b[key]) == "str"):
                      print(f"{a[key]} {b[key]}")
                      equipment_losses.append({key:b[key] - a[key]})
      return equipment_losses

source_raw:
  def daily_losses_personnel() -> list:
      personnel_losses = []
      with open('russia_losses_personnel.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          personnel_losses.append({"losses":b['personnel'] - a['personnel']})
      return personnel_losses[1::1]
  def daily_losses_equipment() -> list:
      equipment_losses = []
      ignore = ["date","day"]
      with open('russia_losses_equipment.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          for key in a.keys():
              if not (key in ignore):
                  if (type(a[key]) == "str") or (type(b[key]) == "str"):
                      print(f"{a[key]} {b[key]}")
                      equipment_losses.append({key:b[key] - a[key]})
      return equipment_losses


source:
  def daily_losses_personnel() -> list:
      personnel_losses = []
      with open('russia_losses_personnel.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          personnel_losses.append({"losses":b['personnel'] - a['personnel']})
      return personnel_losses[1::1]
  def daily_losses_equipment() -> list:
      equipment_losses = []
      ignore = ["date","day"]
      with open('russia_losses_equipment.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          for key in a.keys():
              if not (key in ignore):
                  print(a[key])
                  if (type(a[key]) == "str") or (type(b[key]) == "str"):
                      print(f"{a[key]} {b[key]}")
                      equipment_losses.append({key:b[key] - a[key]})
      return equipment_losses

source_raw:
  def daily_losses_personnel() -> list:
      personnel_losses = []
      with open('russia_losses_personnel.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          personnel_losses.append({"losses":b['personnel'] - a['personnel']})
      return personnel_losses[1::1]
  def daily_losses_equipment() -> list:
      equipment_losses = []
      ignore = ["date","day"]
      with open('russia_losses_equipment.json') as file:
          data = json.load(file)
      for a,b in zip(data,data[1:]):
          for key in a.keys():
              if not (key in ignore):
                  print(a[key])
                  if (type(a[key]) == "str") or (type(b[key]) == "str"):
                      print(f"{a[key]} {b[key]}")
                      equipment_losses.append({key:b[key] - a[key]})
      return equipment_losses


source:
  get_ipython().run_cell_magic('bash', '', 'curl -O https://raw.githubusercontent.com/PetroIvaniuk/2022-Ukraine-Russia-War-Dataset/main/data/russia_losses_equipment.json\ncurl -O https://raw.githubusercontent.com/PetroIvaniuk/2022-Ukraine-Russia-War-Dataset/main/data/russia_losses_personnel.json\n')

source_raw:
  %%bash
  curl -O https://raw.githubusercontent.com/PetroIvaniuk/2022-Ukraine-Russia-War-Dataset/main/data/russia_losses_equipment.json
  curl -O https://raw.githubusercontent.com/PetroIvaniuk/2022-Ukraine-Russia-War-Dataset/main/data/russia_losses_personnel.json


source:
  def daily_losses_personnel() -> list:
      personnel_losses = []
      with open('russia_losses_personnel.json') as fp:
          data = json.load(fp)
      for a,b in zip(data,data[1:]):
          personnel_losses.append({"personnel_losses":b["personnel"] - a["personnel"]})
      return personnel_losses[1::1]

source_raw:
  def daily_losses_personnel() -> list:
      personnel_losses = []
      with open('russia_losses_personnel.json') as fp:
          data = json.load(fp)
      for a,b in zip(data,data[1:]):
          personnel_losses.append({"personnel_losses":b["personnel"] - a["personnel"]})
      return personnel_losses[1::1]


source:
  def daily_losses_personnel() -> list:
      personnel_losses = []
      with open('russia_losses_personnel.json') as fp:
          data = json.load(fp)
      for a,b in zip(data,data[1:]):
          personnel_losses.append({"personnel_losses":b["personnel"] - a["personnel"],"date":b["date"]})
      return personnel_losses[1::1]

source_raw:
  def daily_losses_personnel() -> list:
      personnel_losses = []
      with open('russia_losses_personnel.json') as fp:
          data = json.load(fp)
      for a,b in zip(data,data[1:]):
          personnel_losses.append({"personnel_losses":b["personnel"] - a["personnel"],"date":b["date"]})
      return personnel_losses[1::1]


source:
  line_chart = pygal.Line()
  line_chart.title = 'Personnel losses russia'
  line_chart.x_labels = df["date"]
  line_chart.add('Losses', df["personnel_losses"])
  line_chart.render()

source_raw:
  line_chart = pygal.Line()
  line_chart.title = 'Personnel losses russia'
  line_chart.x_labels = df["date"]
  line_chart.add('Losses', df["personnel_losses"])
  line_chart.render()


source:
  line_chart = pygal.Line()
  line_chart.title = 'Personnel losses russia'
  line_chart.x_labels = df["date"]
  line_chart.add('Losses', df["personnel_losses"])
  line_chart.render_to_file("losses_russia.svg")

source_raw:
  line_chart = pygal.Line()
  line_chart.title = 'Personnel losses russia'
  line_chart.x_labels = df["date"]
  line_chart.add('Losses', df["personnel_losses"])
  line_chart.render_to_file("losses_russia.svg")


source:
  line_chart = pygal.Bar()
  line_chart.title = 'Personnel losses russia'
  line_chart.x_labels = df["date"]
  line_chart.add('Losses', df["personnel_losses"])
  line_chart.render_to_file("losses_russia.svg")

source_raw:
  line_chart = pygal.Bar()
  line_chart.title = 'Personnel losses russia'
  line_chart.x_labels = df["date"]
  line_chart.add('Losses', df["personnel_losses"])
  line_chart.render_to_file("losses_russia.svg")


source:
  line_chart = pygal.Bar(width=100)
  line_chart.title = 'Personnel losses russia'
  line_chart.x_labels = df["date"]
  line_chart.add('Losses', df["personnel_losses"])
  line_chart.render_to_file("losses_russia.svg")

source_raw:
  line_chart = pygal.Bar(width=100)
  line_chart.title = 'Personnel losses russia'
  line_chart.x_labels = df["date"]
  line_chart.add('Losses', df["personnel_losses"])
  line_chart.render_to_file("losses_russia.svg")


source:
  line_chart = pygal.Bar(width=200)
  line_chart.title = 'Personnel losses russia'
  line_chart.x_labels = df["date"]
  line_chart.add('Losses', df["personnel_losses"])
  line_chart.render_to_file("losses_russia.svg")

source_raw:
  line_chart = pygal.Bar(width=200)
  line_chart.title = 'Personnel losses russia'
  line_chart.x_labels = df["date"]
  line_chart.add('Losses', df["personnel_losses"])
  line_chart.render_to_file("losses_russia.svg")


source:
  line_chart = pygal.Bar(width=50)
  line_chart.title = 'Personnel losses russia'
  line_chart.x_labels = df["date"]
  line_chart.add('Losses', df["personnel_losses"])
  line_chart.render_to_file("losses_russia.svg")

source_raw:
  line_chart = pygal.Bar(width=50)
  line_chart.title = 'Personnel losses russia'
  line_chart.x_labels = df["date"]
  line_chart.add('Losses', df["personnel_losses"])
  line_chart.render_to_file("losses_russia.svg")


source:
  line_chart = pygal.Bar(width=10)
  line_chart.title = 'Personnel losses russia'
  line_chart.x_labels = df["date"]
  line_chart.add('Losses', df["personnel_losses"])
  line_chart.render_to_file("losses_russia.svg")

source_raw:
  line_chart = pygal.Bar(width=10)
  line_chart.title = 'Personnel losses russia'
  line_chart.x_labels = df["date"]
  line_chart.add('Losses', df["personnel_losses"])
  line_chart.render_to_file("losses_russia.svg")


source:
  def daily_losses_personnel() -> list:
      personnel_losses = []
      with open('russia_losses_personnel.json') as fp:
          data = json.load(fp)
      for a,b in zip(data,data[1:]):
          personnel_losses.append({"personnel_losses":b["personnel"] - a["personnel"],"date":b["date"]})
      return personnel_losses[1::1][]

source_raw:
  def daily_losses_personnel() -> list:
      personnel_losses = []
      with open('russia_losses_personnel.json') as fp:
          data = json.load(fp)
      for a,b in zip(data,data[1:]):
          personnel_losses.append({"personnel_losses":b["personnel"] - a["personnel"],"date":b["date"]})
      return personnel_losses[1::1][]


source:
  line_chart = pygal.Bar()
  line_chart.title = 'Personnel losses russia'
  line_chart.x_labels = df["date"]
  line_chart.add(df["personnel_losses"])
  line_chart.render_to_file("losses_russia.svg")

source_raw:
  line_chart = pygal.Bar()
  line_chart.title = 'Personnel losses russia'
  line_chart.x_labels = df["date"]
  line_chart.add(df["personnel_losses"])
  line_chart.render_to_file("losses_russia.svg")


source:
  line_chart = pygal.Bar()
  line_chart.title = 'Personnel losses russia'
  line_chart.x_labels = df["date"]
  line_chart.add(values=df["personnel_losses"])
  line_chart.render_to_file("losses_russia.svg")

source_raw:
  line_chart = pygal.Bar()
  line_chart.title = 'Personnel losses russia'
  line_chart.x_labels = df["date"]
  line_chart.add(values=df["personnel_losses"])
  line_chart.render_to_file("losses_russia.svg")


source:
  line_chart = pygal.Bar()
  line_chart.title = 'Personnel losses russia'
  line_chart.x_labels = df["date"]
  line_chart.add(title=None,values=df["personnel_losses"])
  line_chart.render_to_file("losses_russia.svg")

source_raw:
  line_chart = pygal.Bar()
  line_chart.title = 'Personnel losses russia'
  line_chart.x_labels = df["date"]
  line_chart.add(title=None,values=df["personnel_losses"])
  line_chart.render_to_file("losses_russia.svg")


source:
  line_chart = pygal.Bar()
  line_chart.title = 'Personnel losses russia'
  line_chart.x_labels = df["date"]
  line_chart.add(title=None,values=df["personnel_losses"])
  line_chart.render_to_png("russia_personnel_losses_last_week.png")

source_raw:
  line_chart = pygal.Bar()
  line_chart.title = 'Personnel losses russia'
  line_chart.x_labels = df["date"]
  line_chart.add(title=None,values=df["personnel_losses"])
  line_chart.render_to_png("russia_personnel_losses_last_week.png")


source:
  def daily_losses_equipment(equipments:list) -> list[dict]:
      equipment_losses = []
      with open("russia_losses_equipment.json") as fp:
          data = json.load(fp)
      for a,b in zip(data,data[1:]):
          equipment_losses_day = {}
          for equipment in equipments:
              equipment_losses_day[equipment] = b[equipment] - a[equipment]
          equipment_losses_day["date"] = b["date"]
          eqipment_losses.append(equipment_losses_day)
      return equipment_losses

source_raw:
  def daily_losses_equipment(equipments:list) -> list[dict]:
      equipment_losses = []
      with open("russia_losses_equipment.json") as fp:
          data = json.load(fp)
      for a,b in zip(data,data[1:]):
          equipment_losses_day = {}
          for equipment in equipments:
              equipment_losses_day[equipment] = b[equipment] - a[equipment]
          equipment_losses_day["date"] = b["date"]
          eqipment_losses.append(equipment_losses_day)
      return equipment_losses


source:
  def daily_losses_equipment(equipments:list) -> list[dict]:
      equipment_losses = []
      with open("russia_losses_equipment.json") as fp:
          data = json.load(fp)
      for a,b in zip(data,data[1:]):
          equipment_losses_day = {}
          for equipment in equipments:
              equipment_losses_day[equipment] = b[equipment] - a[equipment]
          equipment_losses_day["date"] = b["date"]
          equipment_losses.append(equipment_losses_day)
      return equipment_losses

source_raw:
  def daily_losses_equipment(equipments:list) -> list[dict]:
      equipment_losses = []
      with open("russia_losses_equipment.json") as fp:
          data = json.load(fp)
      for a,b in zip(data,data[1:]):
          equipment_losses_day = {}
          for equipment in equipments:
              equipment_losses_day[equipment] = b[equipment] - a[equipment]
          equipment_losses_day["date"] = b["date"]
          equipment_losses.append(equipment_losses_day)
      return equipment_losses


source:
  data2 = daily_losses_equipment(["aircraft","tank"])
  data2 = data2[len(data2)-7:]
  df = pd.DataFrame.from_dict(data2)

source_raw:
  data2 = daily_losses_equipment(["aircraft","tank"])
  data2 = data2[len(data2)-7:]
  df = pd.DataFrame.from_dict(data2)


source:
  data2 = daily_losses_equipment(["aircraft","tank"])
  data2 = data2[len(data2)-7:]
  df = pd.DataFrame.from_dict(data2)
  print(data2)
  df

source_raw:
  data2 = daily_losses_equipment(["aircraft","tank"])
  data2 = data2[len(data2)-7:]
  df = pd.DataFrame.from_dict(data2)
  print(data2)
  df


source:
  line_chart = pygal.Bar()
  line_chart.title = 'Russia equipment losses tank'
  line_chart.x_labels = df["date"]
  line_chart.add(title=None,values=df["tank"])
  line_chart.render_to_png("russia_equipment_losses_tank_last_week.png")

source_raw:
  line_chart = pygal.Bar()
  line_chart.title = 'Russia equipment losses tank'
  line_chart.x_labels = df["date"]
  line_chart.add(title=None,values=df["tank"])
  line_chart.render_to_png("russia_equipment_losses_tank_last_week.png")


source:
  line_chart = pygal.Bar()
  line_chart.title = 'Russia tanks losses'
  line_chart.x_labels = df["date"]
  line_chart.add(title=None,values=df["tank"])
  line_chart.render_to_png("russia_tank_losses_last_week.png")

source_raw:
  line_chart = pygal.Bar()
  line_chart.title = 'Russia tanks losses'
  line_chart.x_labels = df["date"]
  line_chart.add(title=None,values=df["tank"])
  line_chart.render_to_png("russia_tank_losses_last_week.png")


source:
  def daily_losses_personnel() -> list[dict]:
      personnel_losses = []
      with open('russia_losses_personnel.json') as fp:
          data = json.load(fp)
      for a,b in zip(data,data[1:]):
          personnel_losses.append({"personnel_losses":b["personnel"] - a["personnel"],"date":b["date"]})
      return personnel_losses[1::1]

source_raw:
  def daily_losses_personnel() -> list[dict]:
      personnel_losses = []
      with open('russia_losses_personnel.json') as fp:
          data = json.load(fp)
      for a,b in zip(data,data[1:]):
          personnel_losses.append({"personnel_losses":b["personnel"] - a["personnel"],"date":b["date"]})
      return personnel_losses[1::1]


source:
  data2 = daily_losses_equipment(["aircraft","tank"])
  data2 = data2[len(data2)-7:]
  df = pd.DataFrame.from_dict(data2)
  df

source_raw:
  data2 = daily_losses_equipment(["aircraft","tank"])
  data2 = data2[len(data2)-7:]
  df = pd.DataFrame.from_dict(data2)
  df


source:
  def daily_losses_personnel() -> list[dict]:
      personnel_losses = []
      with open('losses/russia_losses_personnel.json') as fp:
          data = json.load(fp)
      for a,b in zip(data,data[1:]):
          personnel_losses.append({"personnel_losses":b["personnel"] - a["personnel"],"date":b["date"]})
      return personnel_losses[1::1]

source_raw:
  def daily_losses_personnel() -> list[dict]:
      personnel_losses = []
      with open('losses/russia_losses_personnel.json') as fp:
          data = json.load(fp)
      for a,b in zip(data,data[1:]):
          personnel_losses.append({"personnel_losses":b["personnel"] - a["personnel"],"date":b["date"]})
      return personnel_losses[1::1]


source:
  line_chart = pygal.Bar()
  line_chart.title = 'Personnel losses russia'
  line_chart.x_labels = df["date"]
  line_chart.add(None,df["personnel_losses"])
  line_chart.render_to_png("russia_personnel_losses_last_week.png")

source_raw:
  line_chart = pygal.Bar()
  line_chart.title = 'Personnel losses russia'
  line_chart.x_labels = df["date"]
  line_chart.add(None,df["personnel_losses"])
  line_chart.render_to_png("russia_personnel_losses_last_week.png")


source:
  def daily_losses_equipment(equipments:list) -> list[dict]:
      equipment_losses = []
      with open("lossesrussia_losses_equipment.json") as fp:
          data = json.load(fp)
      for a,b in zip(data,data[1:]):
          equipment_losses_day = {}
          for equipment in equipments:
              equipment_losses_day[equipment] = b[equipment] - a[equipment]
          equipment_losses_day["date"] = b["date"]
          equipment_losses.append(equipment_losses_day)
      return equipment_losses

source_raw:
  def daily_losses_equipment(equipments:list) -> list[dict]:
      equipment_losses = []
      with open("lossesrussia_losses_equipment.json") as fp:
          data = json.load(fp)
      for a,b in zip(data,data[1:]):
          equipment_losses_day = {}
          for equipment in equipments:
              equipment_losses_day[equipment] = b[equipment] - a[equipment]
          equipment_losses_day["date"] = b["date"]
          equipment_losses.append(equipment_losses_day)
      return equipment_losses


source:
  def daily_losses_equipment(equipments:list) -> list[dict]:
      equipment_losses = []
      with open("losses/russia_losses_equipment.json") as fp:
          data = json.load(fp)
      for a,b in zip(data,data[1:]):
          equipment_losses_day = {}
          for equipment in equipments:
              equipment_losses_day[equipment] = b[equipment] - a[equipment]
          equipment_losses_day["date"] = b["date"]
          equipment_losses.append(equipment_losses_day)
      return equipment_losses

source_raw:
  def daily_losses_equipment(equipments:list) -> list[dict]:
      equipment_losses = []
      with open("losses/russia_losses_equipment.json") as fp:
          data = json.load(fp)
      for a,b in zip(data,data[1:]):
          equipment_losses_day = {}
          for equipment in equipments:
              equipment_losses_day[equipment] = b[equipment] - a[equipment]
          equipment_losses_day["date"] = b["date"]
          equipment_losses.append(equipment_losses_day)
      return equipment_losses


source:
  line_chart = pygal.Bar()
  line_chart.title = 'Russia tanks losses'
  line_chart.x_labels = df["date"]
  line_chart.add(None,df["tank"])
  line_chart.render_to_png("russia_tank_losses_last_week.png")

source_raw:
  line_chart = pygal.Bar()
  line_chart.title = 'Russia tanks losses'
  line_chart.x_labels = df["date"]
  line_chart.add(None,df["tank"])
  line_chart.render_to_png("russia_tank_losses_last_week.png")


source:
  def daily_losses_personnel() -> list[dict]:
      personnel_losses = []
      with open('losses/personnel.json') as fp:
          data = json.load(fp)
      for a,b in zip(data,data[1:]):
          personnel_losses.append({"personnel_losses":b["personnel"] - a["personnel"],"date":b["date"]})
      return personnel_losses[1::1]

source_raw:
  def daily_losses_personnel() -> list[dict]:
      personnel_losses = []
      with open('losses/personnel.json') as fp:
          data = json.load(fp)
      for a,b in zip(data,data[1:]):
          personnel_losses.append({"personnel_losses":b["personnel"] - a["personnel"],"date":b["date"]})
      return personnel_losses[1::1]


source:
  get_ipython().run_cell_magic('bash', '', 'curl -O https://raw.githubusercontent.com/PetroIvaniuk/2022-Ukraine-Russia-War-Dataset/main/data/russia_losses_equipment.json > losses/equipment.json\ncurl -O https://raw.githubusercontent.com/PetroIvaniuk/2022-Ukraine-Russia-War-Dataset/main/data/russia_losses_personnel.json > losses/personnel.json\n')

source_raw:
  %%bash
  curl -O https://raw.githubusercontent.com/PetroIvaniuk/2022-Ukraine-Russia-War-Dataset/main/data/russia_losses_equipment.json > losses/equipment.json
  curl -O https://raw.githubusercontent.com/PetroIvaniuk/2022-Ukraine-Russia-War-Dataset/main/data/russia_losses_personnel.json > losses/personnel.json


source:
  get_ipython().run_cell_magic('bash', '', 'curl -o losses/equipment.json https://raw.githubusercontent.com/PetroIvaniuk/2022-Ukraine-Russia-War-Dataset/main/data/russia_losses_equipment.json\ncurl -o losses/personnel.json https://raw.githubusercontent.com/PetroIvaniuk/2022-Ukraine-Russia-War-Dataset/main/data/russia_losses_personnel.json > losses/personnel.json\n')

source_raw:
  %%bash
  curl -o losses/equipment.json https://raw.githubusercontent.com/PetroIvaniuk/2022-Ukraine-Russia-War-Dataset/main/data/russia_losses_equipment.json
  curl -o losses/personnel.json https://raw.githubusercontent.com/PetroIvaniuk/2022-Ukraine-Russia-War-Dataset/main/data/russia_losses_personnel.json > losses/personnel.json


source:
  line_chart = pygal.Bar()
  line_chart.title = 'Personnel losses russia'
  line_chart.x_labels = df["date"]
  line_chart.add(None,df["personnel_losses"])
  line_chart.render_to_png("images/personnel_losses_last_week.png")

source_raw:
  line_chart = pygal.Bar()
  line_chart.title = 'Personnel losses russia'
  line_chart.x_labels = df["date"]
  line_chart.add(None,df["personnel_losses"])
  line_chart.render_to_png("images/personnel_losses_last_week.png")


source:
  def daily_losses_equipment(equipments:list) -> list[dict]:
      equipment_losses = []
      with open("losses/equipment.json") as fp:
          data = json.load(fp)
      for a,b in zip(data,data[1:]):
          equipment_losses_day = {}
          for equipment in equipments:
              equipment_losses_day[equipment] = b[equipment] - a[equipment]
          equipment_losses_day["date"] = b["date"]
          equipment_losses.append(equipment_losses_day)
      return equipment_losses

source_raw:
  def daily_losses_equipment(equipments:list) -> list[dict]:
      equipment_losses = []
      with open("losses/equipment.json") as fp:
          data = json.load(fp)
      for a,b in zip(data,data[1:]):
          equipment_losses_day = {}
          for equipment in equipments:
              equipment_losses_day[equipment] = b[equipment] - a[equipment]
          equipment_losses_day["date"] = b["date"]
          equipment_losses.append(equipment_losses_day)
      return equipment_losses


source:
  line_chart = pygal.Bar()
  line_chart.title = 'Russia tanks losses'
  line_chart.x_labels = df["date"]
  line_chart.add(None,df["tank"])
  line_chart.render_to_png("images/tank_losses_last_week.png")

source_raw:
  line_chart = pygal.Bar()
  line_chart.title = 'Russia tanks losses'
  line_chart.x_labels = df["date"]
  line_chart.add(None,df["tank"])
  line_chart.render_to_png("images/tank_losses_last_week.png")


source:
  def losses_personnel(filepath:str) -> list[dict]:
      personnel_losses = []
      with open(filepath) as fp:
          data = json.load(fp)
      for a,b in zip(data,data[1:]):
          personnel_losses.append({"personnel_losses":b["personnel"] - a["personnel"],"date":b["date"]})
      return personnel_losses[1::1]

  def losses_equipment(filepath:str,equipments:list) -> list[dict]:
      equipments_losses = []
      with open(filepth) as fp:
          data = json.load(fp)
      for a,b in zip(data,data[1:]):
          losses = {}
          for equipment in equipments:
              losses[equipment] = b{equipment} - a[equipment]
          losses["date"] = b["date"]
          equipments_losses.append(losses)

source_raw:
  def losses_personnel(filepath:str) -> list[dict]:
      personnel_losses = []
      with open(filepath) as fp:
          data = json.load(fp)
      for a,b in zip(data,data[1:]):
          personnel_losses.append({"personnel_losses":b["personnel"] - a["personnel"],"date":b["date"]})
      return personnel_losses[1::1]

  def losses_equipment(filepath:str,equipments:list) -> list[dict]:
      equipments_losses = []
      with open(filepth) as fp:
          data = json.load(fp)
      for a,b in zip(data,data[1:]):
          losses = {}
          for equipment in equipments:
              losses[equipment] = b{equipment} - a[equipment]
          losses["date"] = b["date"]
          equipments_losses.append(losses)


source:
  data2 = daily_losses_equipment("losses/equipment.json",["aircraft","tank"])
  data2 = data2[len(data2)-7:]
  df = pd.DataFrame.from_dict(data2)
  df

source_raw:
  data2 = daily_losses_equipment("losses/equipment.json",["aircraft","tank"])
  data2 = data2[len(data2)-7:]
  df = pd.DataFrame.from_dict(data2)
  df


source:
  def losses_personnel(filepath:str) -> list[dict]:
      personnel_losses = []
      with open(filepath) as fp:
          data = json.load(fp)
      for a,b in zip(data,data[1:]):
          personnel_losses.append({"personnel_losses":b["personnel"] - a["personnel"],"date":b["date"]})
      return personnel_losses[1::1]

  def losses_equipment(filepath:str,equipments:list) -> list[dict]:
      equipments_losses = []
      with open(filepth) as fp:
          data = json.load(fp)
      for a,b in zip(data,data[1:]):
          losses = {}
          for equipment in equipments:
              losses[equipment] = b[equipment} - a[equipment]
          losses["date"] = b["date"]
          equipments_losses.append(losses)

source_raw:
  def losses_personnel(filepath:str) -> list[dict]:
      personnel_losses = []
      with open(filepath) as fp:
          data = json.load(fp)
      for a,b in zip(data,data[1:]):
          personnel_losses.append({"personnel_losses":b["personnel"] - a["personnel"],"date":b["date"]})
      return personnel_losses[1::1]

  def losses_equipment(filepath:str,equipments:list) -> list[dict]:
      equipments_losses = []
      with open(filepth) as fp:
          data = json.load(fp)
      for a,b in zip(data,data[1:]):
          losses = {}
          for equipment in equipments:
              losses[equipment] = b[equipment} - a[equipment]
          losses["date"] = b["date"]
          equipments_losses.append(losses)


source:
  def losses_personnel(filepath:str) -> list[dict]:
      personnel_losses = []
      with open(filepath) as fp:
          data = json.load(fp)
      for a,b in zip(data,data[1:]):
          personnel_losses.append({"personnel_losses":b["personnel"] - a["personnel"],"date":b["date"]})
      return personnel_losses[1::1]

  def losses_equipment(filepath:str,equipments:list) -> list[dict]:
      equipments_losses = []
      with open(filepth) as fp:
          data = json.load(fp)
      for a,b in zip(data,data[1:]):
          losses = {}
          for equipment in equipments:
              losses[equipment] = b[equipment] - a[equipment]
          losses["date"] = b["date"]
          equipments_losses.append(losses)

source_raw:
  def losses_personnel(filepath:str) -> list[dict]:
      personnel_losses = []
      with open(filepath) as fp:
          data = json.load(fp)
      for a,b in zip(data,data[1:]):
          personnel_losses.append({"personnel_losses":b["personnel"] - a["personnel"],"date":b["date"]})
      return personnel_losses[1::1]

  def losses_equipment(filepath:str,equipments:list) -> list[dict]:
      equipments_losses = []
      with open(filepth) as fp:
          data = json.load(fp)
      for a,b in zip(data,data[1:]):
          losses = {}
          for equipment in equipments:
              losses[equipment] = b[equipment] - a[equipment]
          losses["date"] = b["date"]
          equipments_losses.append(losses)


source:
  personnel_daily_losses = losses_personnel("losses/personnel.json")
  last_week = data[len(data)-7:]
  personnel_last_week_losses = pd.DataFrame.from_dict(data)

source_raw:
  personnel_daily_losses = losses_personnel("losses/personnel.json")
  last_week = data[len(data)-7:]
  personnel_last_week_losses = pd.DataFrame.from_dict(data)


source:
  personnel_daily_losses = losses_personnel("losses/personnel.json")
  last_week = data[len(personnel_daily_losses)-7:]
  personnel_last_week_losses = pd.DataFrame.from_dict(data)

source_raw:
  personnel_daily_losses = losses_personnel("losses/personnel.json")
  last_week = data[len(personnel_daily_losses)-7:]
  personnel_last_week_losses = pd.DataFrame.from_dict(data)


source:
  personnel_daily_losses = losses_personnel("losses/personnel.json")
  last_week = data[len(personnel_daily_losses)-7:]
  personnel_last_week_losses = pd.DataFrame.from_dict(last_week)

source_raw:
  personnel_daily_losses = losses_personnel("losses/personnel.json")
  last_week = data[len(personnel_daily_losses)-7:]
  personnel_last_week_losses = pd.DataFrame.from_dict(last_week)


source:
  personnel_daily_losses = losses_personnel("losses/personnel.json")
  last_week = personnel_daily_losses[len(personnel_daily_losses)-7:]
  personnel_last_week_losses = pd.DataFrame.from_dict(last_week)

source_raw:
  personnel_daily_losses = losses_personnel("losses/personnel.json")
  last_week = personnel_daily_losses[len(personnel_daily_losses)-7:]
  personnel_last_week_losses = pd.DataFrame.from_dict(last_week)


source:
  line_chart = pygal.Bar()
  line_chart.title = 'Personnel losses russia'
  line_chart.x_labels = personnel_last_week_losses["date"]
  line_chart.add(None,personnel_last_week_losses["personnel_losses"])
  line_chart.render_to_png("images/personnel_losses_last_week.png")

source_raw:
  line_chart = pygal.Bar()
  line_chart.title = 'Personnel losses russia'
  line_chart.x_labels = personnel_last_week_losses["date"]
  line_chart.add(None,personnel_last_week_losses["personnel_losses"])
  line_chart.render_to_png("images/personnel_losses_last_week.png")


source:
  tanks_daily_losses = daily_losses_equipment("losses/equipment.json",["aircraft","tank"])
  last_week = tanks_daily_losses[len(tanks_daily_losses)-7:]
  df = pd.DataFrame.from_dict(last_week)

source_raw:
  tanks_daily_losses = daily_losses_equipment("losses/equipment.json",["aircraft","tank"])
  last_week = tanks_daily_losses[len(tanks_daily_losses)-7:]
  df = pd.DataFrame.from_dict(last_week)


source:
  tanks_daily_losses = losses_equipment("losses/equipment.json",["aircraft","tank"])
  last_week = tanks_daily_losses[len(tanks_daily_losses)-7:]
  df = pd.DataFrame.from_dict(last_week)

source_raw:
  tanks_daily_losses = losses_equipment("losses/equipment.json",["aircraft","tank"])
  last_week = tanks_daily_losses[len(tanks_daily_losses)-7:]
  df = pd.DataFrame.from_dict(last_week)


source:
  def losses_personnel(filepath:str) -> list[dict]:
      personnel_losses = []
      with open(filepath) as fp:
          data = json.load(fp)
      for a,b in zip(data,data[1:]):
          personnel_losses.append({"personnel_losses":b["personnel"] - a["personnel"],"date":b["date"]})
      return personnel_losses[1::1]

  def losses_equipment(filepath:str,equipments:list) -> list[dict]:
      equipments_losses = []
      with open(filepath) as fp:
          data = json.load(fp)
      for a,b in zip(data,data[1:]):
          losses = {}
          for equipment in equipments:
              losses[equipment] = b[equipment] - a[equipment]
          losses["date"] = b["date"]
          equipments_losses.append(losses)

source_raw:
  def losses_personnel(filepath:str) -> list[dict]:
      personnel_losses = []
      with open(filepath) as fp:
          data = json.load(fp)
      for a,b in zip(data,data[1:]):
          personnel_losses.append({"personnel_losses":b["personnel"] - a["personnel"],"date":b["date"]})
      return personnel_losses[1::1]

  def losses_equipment(filepath:str,equipments:list) -> list[dict]:
      equipments_losses = []
      with open(filepath) as fp:
          data = json.load(fp)
      for a,b in zip(data,data[1:]):
          losses = {}
          for equipment in equipments:
              losses[equipment] = b[equipment] - a[equipment]
          losses["date"] = b["date"]
          equipments_losses.append(losses)


source:
  def losses_personnel(filepath:str) -> list[dict]:
      personnel_losses = []
      with open(filepath) as fp:
          data = json.load(fp)
      for a,b in zip(data,data[1:]):
          personnel_losses.append({"personnel_losses":b["personnel"] - a["personnel"],"date":b["date"]})
      return personnel_losses[1::1]

  def losses_equipment(filepath:str,equipments:list) -> list[dict]:
      equipments_losses = []
      with open(filepath) as fp:
          data = json.load(fp)
      for a,b in zip(data,data[1:]):
          losses = {}
          for equipment in equipments:
              losses[equipment] = b[equipment] - a[equipment]
          losses["date"] = b["date"]
          equipments_losses.append(losses)
      return equipments_losses

source_raw:
  def losses_personnel(filepath:str) -> list[dict]:
      personnel_losses = []
      with open(filepath) as fp:
          data = json.load(fp)
      for a,b in zip(data,data[1:]):
          personnel_losses.append({"personnel_losses":b["personnel"] - a["personnel"],"date":b["date"]})
      return personnel_losses[1::1]

  def losses_equipment(filepath:str,equipments:list) -> list[dict]:
      equipments_losses = []
      with open(filepath) as fp:
          data = json.load(fp)
      for a,b in zip(data,data[1:]):
          losses = {}
          for equipment in equipments:
              losses[equipment] = b[equipment] - a[equipment]
          losses["date"] = b["date"]
          equipments_losses.append(losses)
      return equipments_losses


source:
  def fact(n:int) -> int:
      if (n == 0) or (n == 1):
          return 1
      else:
          return n * fact(n)
          

source_raw:
  def fact(n:int) -> int:
      if (n == 0) or (n == 1):
          return 1
      else:
          return n * fact(n)
          


source:
  def fact(n:int) -> int:
      if (n == 0) or (n == 1):
          return 1
      else:
          return n * fact(n-1)
          

source_raw:
  def fact(n:int) -> int:
      if (n == 0) or (n == 1):
          return 1
      else:
          return n * fact(n-1)
          


source:
  personnel_daily_losses = losses_personnel("losses/personnel.json")
  last_week = personnel_daily_losses[len(personnel_daily_losses)-2:]
  personnel_last_week_losses = pd.DataFrame.from_dict(last_week)

source_raw:
  personnel_daily_losses = losses_personnel("losses/personnel.json")
  last_week = personnel_daily_losses[len(personnel_daily_losses)-2:]
  personnel_last_week_losses = pd.DataFrame.from_dict(last_week)


source:
  tanks_daily_losses = losses_equipment("losses/equipment.json",["aircraft"])
  last_week = tanks_daily_losses[len(tanks_daily_losses)-2:]
  df = pd.DataFrame.from_dict(last_week)

source_raw:
  tanks_daily_losses = losses_equipment("losses/equipment.json",["aircraft"])
  last_week = tanks_daily_losses[len(tanks_daily_losses)-2:]
  df = pd.DataFrame.from_dict(last_week)


source:
  line_chart = pygal.Bar()
  line_chart.title = 'Russia tanks losses'
  line_chart.x_labels = df["date"]
  line_chart.add(None,df["aircraft"])
  line_chart.render_to_png("images/tank_losses_last_week.png")

source_raw:
  line_chart = pygal.Bar()
  line_chart.title = 'Russia tanks losses'
  line_chart.x_labels = df["date"]
  line_chart.add(None,df["aircraft"])
  line_chart.render_to_png("images/tank_losses_last_week.png")


source:
  line_chart = pygal.Bar()
  line_chart.title = 'Russia tanks losses'
  line_chart.x_labels = df["date"]
  line_chart.add(None,df["aircraft"])
  line_chart.render_to_png("images/aircraft_losses_last_week.png")

source_raw:
  line_chart = pygal.Bar()
  line_chart.title = 'Russia tanks losses'
  line_chart.x_labels = df["date"]
  line_chart.add(None,df["aircraft"])
  line_chart.render_to_png("images/aircraft_losses_last_week.png")


source:
  personnel_daily_losses = losses_personnel("losses/personnel.json")
  last_week = personnel_daily_losses[len(personnel_daily_losses)-5:]
  personnel_last_week_losses = pd.DataFrame.from_dict(last_week)

source_raw:
  personnel_daily_losses = losses_personnel("losses/personnel.json")
  last_week = personnel_daily_losses[len(personnel_daily_losses)-5:]
  personnel_last_week_losses = pd.DataFrame.from_dict(last_week)


source:
  tanks_daily_losses = losses_equipment("losses/equipment.json",["aircraft"])
  last_week = tanks_daily_losses[len(tanks_daily_losses)-5:]
  df = pd.DataFrame.from_dict(last_week)

source_raw:
  tanks_daily_losses = losses_equipment("losses/equipment.json",["aircraft"])
  last_week = tanks_daily_losses[len(tanks_daily_losses)-5:]
  df = pd.DataFrame.from_dict(last_week)


source:
  aircraft_daily_losses = losses_equipment("losses/equipment.json",["aircraft"])
  last_week = aircraft_daily_losses[len(tanks_daily_losses)-5:]
  df = pd.DataFrame.from_dict(last_week)

source_raw:
  aircraft_daily_losses = losses_equipment("losses/equipment.json",["aircraft"])
  last_week = aircraft_daily_losses[len(tanks_daily_losses)-5:]
  df = pd.DataFrame.from_dict(last_week)


source:
  aircraft_daily_losses = losses_equipment("losses/equipment.json",["aircraft"])
  last_week = aircraft_daily_losses[len(aircraft_daily_losses)-7:]
  df = pd.DataFrame.from_dict(last_week)

source_raw:
  aircraft_daily_losses = losses_equipment("losses/equipment.json",["aircraft"])
  last_week = aircraft_daily_losses[len(aircraft_daily_losses)-7:]
  df = pd.DataFrame.from_dict(last_week)


source:
  line_chart = pygal.Bar()
  line_chart.title = 'Russia aircraft losses'
  line_chart.x_labels = df["date"]
  line_chart.add(None,df["aircraft"])
  line_chart.render_to_png("images/aircraft_losses_last_week.png")

source_raw:
  line_chart = pygal.Bar()
  line_chart.title = 'Russia aircraft losses'
  line_chart.x_labels = df["date"]
  line_chart.add(None,df["aircraft"])
  line_chart.render_to_png("images/aircraft_losses_last_week.png")


source:
  personnel_daily_losses = losses_personnel("losses/personnel.json")
  last_week = personnel_daily_losses[len(personnel_daily_losses)-5+1:]
  personnel_last_week_losses = pd.DataFrame.from_dict(last_week)

source_raw:
  personnel_daily_losses = losses_personnel("losses/personnel.json")
  last_week = personnel_daily_losses[len(personnel_daily_losses)-5+1:]
  personnel_last_week_losses = pd.DataFrame.from_dict(last_week)


source:
  aircraft_daily_losses = losses_equipment("losses/equipment.json",["aircraft"])
  last_week = aircraft_daily_losses[len(aircraft_daily_losses)-5+1:]
  df = pd.DataFrame.from_dict(last_week)

source_raw:
  aircraft_daily_losses = losses_equipment("losses/equipment.json",["aircraft"])
  last_week = aircraft_daily_losses[len(aircraft_daily_losses)-5+1:]
  df = pd.DataFrame.from_dict(last_week)


source:
  aircraft_daily_losses = losses_equipment("losses/equipment.json",["aircraft"])
  last_week = aircraft_daily_losses[len(aircraft_daily_losses)-8:]
  df = pd.DataFrame.from_dict(last_week)

source_raw:
  aircraft_daily_losses = losses_equipment("losses/equipment.json",["aircraft"])
  last_week = aircraft_daily_losses[len(aircraft_daily_losses)-8:]
  df = pd.DataFrame.from_dict(last_week)


source:
  # Groupping by week
  chart = pygal.Line()
  aircraft_daily_losses = losses_equipment("losses/equipment.json",["aircraft"])
  last_month = aircraft_daily_losses[len(aircraft_daily_losses)-31:]
  df = pd.DataFrame.from_dict(last_month)
  df.groupby(df.index.hour)

source_raw:
  # Groupping by week
  chart = pygal.Line()
  aircraft_daily_losses = losses_equipment("losses/equipment.json",["aircraft"])
  last_month = aircraft_daily_losses[len(aircraft_daily_losses)-31:]
  df = pd.DataFrame.from_dict(last_month)
  df.groupby(df.index.hour)


source:
  # Groupping by week
  chart = pygal.Line()
  aircraft_daily_losses = losses_equipment("losses/equipment.json",["aircraft"])
  last_month = aircraft_daily_losses[len(aircraft_daily_losses)-31:]
  df = pd.DataFrame.from_dict(last_month)
  df["date"] = pd.to_datetime(df["date"])
  df.groupby(df["date"].index.hour)

source_raw:
  # Groupping by week
  chart = pygal.Line()
  aircraft_daily_losses = losses_equipment("losses/equipment.json",["aircraft"])
  last_month = aircraft_daily_losses[len(aircraft_daily_losses)-31:]
  df = pd.DataFrame.from_dict(last_month)
  df["date"] = pd.to_datetime(df["date"])
  df.groupby(df["date"].index.hour)


source:
  # Groupping by week
  chart = pygal.Line()
  aircraft_daily_losses = losses_equipment("losses/equipment.json",["aircraft"])
  last_month = aircraft_daily_losses[len(aircraft_daily_losses)-31:]
  df = pd.DataFrame.from_dict(last_month)
  df["date"] = pd.to_datetime(df["date"])
  df.groupby(df.index.hour)

source_raw:
  # Groupping by week
  chart = pygal.Line()
  aircraft_daily_losses = losses_equipment("losses/equipment.json",["aircraft"])
  last_month = aircraft_daily_losses[len(aircraft_daily_losses)-31:]
  df = pd.DataFrame.from_dict(last_month)
  df["date"] = pd.to_datetime(df["date"])
  df.groupby(df.index.hour)


source:
  # Groupping by week
  chart = pygal.Line()
  aircraft_daily_losses = losses_equipment("losses/equipment.json",["aircraft"])
  last_month = aircraft_daily_losses[len(aircraft_daily_losses)-31:]
  df = pd.DataFrame.from_dict(last_month)
  df.groupby(pd.Grouper(key='Datetime', freq="1D"))

source_raw:
  # Groupping by week
  chart = pygal.Line()
  aircraft_daily_losses = losses_equipment("losses/equipment.json",["aircraft"])
  last_month = aircraft_daily_losses[len(aircraft_daily_losses)-31:]
  df = pd.DataFrame.from_dict(last_month)
  df.groupby(pd.Grouper(key='Datetime', freq="1D"))


source:
  # Groupping by week
  chart = pygal.Line()
  aircraft_daily_losses = losses_equipment("losses/equipment.json",["aircraft"])
  last_month = aircraft_daily_losses[len(aircraft_daily_losses)-31:]
  df = pd.DataFrame.from_dict(last_month)
  df.groupby(pd.Grouper(key='date', freq="1D"))

source_raw:
  # Groupping by week
  chart = pygal.Line()
  aircraft_daily_losses = losses_equipment("losses/equipment.json",["aircraft"])
  last_month = aircraft_daily_losses[len(aircraft_daily_losses)-31:]
  df = pd.DataFrame.from_dict(last_month)
  df.groupby(pd.Grouper(key='date', freq="1D"))


source:
  # Groupping by week
  chart = pygal.Line()
  aircraft_daily_losses = losses_equipment("losses/equipment.json",["aircraft"])
  last_month = aircraft_daily_losses[len(aircraft_daily_losses)-31:]
  df = pd.DataFrame.from_dict(last_month)
  df["date"] = pd.to_datetime(df["date"])
  df.groupby(pd.Grouper(key='date', freq="1D"))

source_raw:
  # Groupping by week
  chart = pygal.Line()
  aircraft_daily_losses = losses_equipment("losses/equipment.json",["aircraft"])
  last_month = aircraft_daily_losses[len(aircraft_daily_losses)-31:]
  df = pd.DataFrame.from_dict(last_month)
  df["date"] = pd.to_datetime(df["date"])
  df.groupby(pd.Grouper(key='date', freq="1D"))


source:
  # Groupping by week
  chart = pygal.Line()
  aircraft_daily_losses = losses_equipment("losses/equipment.json",["aircraft"])
  last_month = aircraft_daily_losses[len(aircraft_daily_losses)-31:]
  df = pd.DataFrame.from_dict(last_month)
  df["date"] = pd.to_datetime(df["date"])
  df.groupby(pd.Grouper(key='date', freq="1D")).head()

source_raw:
  # Groupping by week
  chart = pygal.Line()
  aircraft_daily_losses = losses_equipment("losses/equipment.json",["aircraft"])
  last_month = aircraft_daily_losses[len(aircraft_daily_losses)-31:]
  df = pd.DataFrame.from_dict(last_month)
  df["date"] = pd.to_datetime(df["date"])
  df.groupby(pd.Grouper(key='date', freq="1D")).head()


source:
  # Groupping by week
  chart = pygal.Line()
  aircraft_daily_losses = losses_equipment("losses/equipment.json",["aircraft"])
  last_month = aircraft_daily_losses[len(aircraft_daily_losses)-31:]
  df = pd.DataFrame.from_dict(last_month)
  df["date"] = pd.to_datetime(df["date"])
  df.groupby(pd.Grouper(key='date', freq="7D")).head()

source_raw:
  # Groupping by week
  chart = pygal.Line()
  aircraft_daily_losses = losses_equipment("losses/equipment.json",["aircraft"])
  last_month = aircraft_daily_losses[len(aircraft_daily_losses)-31:]
  df = pd.DataFrame.from_dict(last_month)
  df["date"] = pd.to_datetime(df["date"])
  df.groupby(pd.Grouper(key='date', freq="7D")).head()


source:
  # Groupping by week
  chart = pygal.Line()
  aircraft_daily_losses = losses_equipment("losses/equipment.json",["aircraft"])
  last_month = aircraft_daily_losses[len(aircraft_daily_losses)-31:]
  df = pd.DataFrame.from_dict(last_month)
  df["date"] = pd.to_datetime(df["date"])
  df.groupby(pd.Grouper(key='date', freq="7D"))

source_raw:
  # Groupping by week
  chart = pygal.Line()
  aircraft_daily_losses = losses_equipment("losses/equipment.json",["aircraft"])
  last_month = aircraft_daily_losses[len(aircraft_daily_losses)-31:]
  df = pd.DataFrame.from_dict(last_month)
  df["date"] = pd.to_datetime(df["date"])
  df.groupby(pd.Grouper(key='date', freq="7D"))


source:
  # Groupping by week
  chart = pygal.Line()
  aircraft_daily_losses = losses_equipment("losses/equipment.json",["aircraft"])
  last_month = aircraft_daily_losses[len(aircraft_daily_losses)-31:]
  df = pd.DataFrame.from_dict(last_month)
  df["date"] = pd.to_datetime(df["date"])
  df.groupby(pd.Grouper(key='date', freq="7D")dfcounts = df.groupby(pd.Grouper(freq='7D'))

source_raw:
  # Groupping by week
  chart = pygal.Line()
  aircraft_daily_losses = losses_equipment("losses/equipment.json",["aircraft"])
  last_month = aircraft_daily_losses[len(aircraft_daily_losses)-31:]
  df = pd.DataFrame.from_dict(last_month)
  df["date"] = pd.to_datetime(df["date"])
  df.groupby(pd.Grouper(key='date', freq="7D")dfcounts = df.groupby(pd.Grouper(freq='7D'))


source:
  # Groupping by week
  chart = pygal.Line()
  aircraft_daily_losses = losses_equipment("losses/equipment.json",["aircraft"])
  last_month = aircraft_daily_losses[len(aircraft_daily_losses)-31:]
  df = pd.DataFrame.from_dict(last_month)
  df["date"] = pd.to_datetime(df["date"])
  df.groupby(pd.Grouper(freq='7D'))

source_raw:
  # Groupping by week
  chart = pygal.Line()
  aircraft_daily_losses = losses_equipment("losses/equipment.json",["aircraft"])
  last_month = aircraft_daily_losses[len(aircraft_daily_losses)-31:]
  df = pd.DataFrame.from_dict(last_month)
  df["date"] = pd.to_datetime(df["date"])
  df.groupby(pd.Grouper(freq='7D'))


source:
  # Groupping by week
  chart = pygal.Line()
  aircraft_daily_losses = losses_equipment("losses/equipment.json",["aircraft"])
  last_month = aircraft_daily_losses[len(aircraft_daily_losses)-31:]
  df = pd.DataFrame.from_dict(last_month)
  df["date"] = pd.to_datetime(df["date"])
  df.groupby(pd.Grouper(key="date",freq='7D'))

source_raw:
  # Groupping by week
  chart = pygal.Line()
  aircraft_daily_losses = losses_equipment("losses/equipment.json",["aircraft"])
  last_month = aircraft_daily_losses[len(aircraft_daily_losses)-31:]
  df = pd.DataFrame.from_dict(last_month)
  df["date"] = pd.to_datetime(df["date"])
  df.groupby(pd.Grouper(key="date",freq='7D'))


source:
  # Groupping by week
  aircraft_daily_losses = losses_equipment("losses/equipment.json",["aircraft"])
  last_month = aircraft_daily_losses[len(aircraft_daily_losses)-31:]
  df = pd.DataFrame.from_dict(last_month)
  df["date"] = pd.to_datetime(df["date"])
  df.groupby(pd.Grouper(key="date",freq='7D'))

source_raw:
  # Groupping by week
  aircraft_daily_losses = losses_equipment("losses/equipment.json",["aircraft"])
  last_month = aircraft_daily_losses[len(aircraft_daily_losses)-31:]
  df = pd.DataFrame.from_dict(last_month)
  df["date"] = pd.to_datetime(df["date"])
  df.groupby(pd.Grouper(key="date",freq='7D'))


source:
  # Groupping by week
  aircraft_daily_losses = losses_equipment("losses/equipment.json",["aircraft"])
  last_month = aircraft_daily_losses[len(aircraft_daily_losses)-31:]
  df = pd.DataFrame.from_dict(last_month)
  df["date"] = pd.to_datetime(df["date"])
  df.groupby(pd.Grouper(key="date",freq='7D')).first()

source_raw:
  # Groupping by week
  aircraft_daily_losses = losses_equipment("losses/equipment.json",["aircraft"])
  last_month = aircraft_daily_losses[len(aircraft_daily_losses)-31:]
  df = pd.DataFrame.from_dict(last_month)
  df["date"] = pd.to_datetime(df["date"])
  df.groupby(pd.Grouper(key="date",freq='7D')).first()


source:
  # Groupping by week
  aircraft_daily_losses = losses_equipment("losses/equipment.json",["tank"])
  last_month = aircraft_daily_losses[len(aircraft_daily_losses)-31:]
  df = pd.DataFrame.from_dict(last_month)
  df["date"] = pd.to_datetime(df["date"])
  df.groupby(pd.Grouper(key="date",freq='7D')).first()

source_raw:
  # Groupping by week
  aircraft_daily_losses = losses_equipment("losses/equipment.json",["tank"])
  last_month = aircraft_daily_losses[len(aircraft_daily_losses)-31:]
  df = pd.DataFrame.from_dict(last_month)
  df["date"] = pd.to_datetime(df["date"])
  df.groupby(pd.Grouper(key="date",freq='7D')).first()


source:
  df = pd.read_csv("dataset.csv")
  df["date"] = pd.to_datetime(df["date"])
  df = df[:32]
  df.groupby(pd.Grouper(key="date",freq="5M"))

source_raw:
  df = pd.read_csv("dataset.csv")
  df["date"] = pd.to_datetime(df["date"])
  df = df[:32]
  df.groupby(pd.Grouper(key="date",freq="5M"))


source:
  df = pd.read_csv("dataset.csv")
  df["date"] = pd.to_datetime(df["date"])
  df = df[:32]
  df.groupby(pd.Grouper(key="date",freq="5M")).first()

source_raw:
  df = pd.read_csv("dataset.csv")
  df["date"] = pd.to_datetime(df["date"])
  df = df[:32]
  df.groupby(pd.Grouper(key="date",freq="5M")).first()


source:
  df = pd.read_csv("dataset.csv")
  df["date"] = pd.to_datetime(df["date"])
  df = df[:32]
  df.groupby(pd.Grouper(key="date",freq="5M")).head()

source_raw:
  df = pd.read_csv("dataset.csv")
  df["date"] = pd.to_datetime(df["date"])
  df = df[:32]
  df.groupby(pd.Grouper(key="date",freq="5M")).head()


source:
  df = pd.read_csv("dataset.csv")
  df["date"] = pd.to_datetime(df["date"])
  df = df[:32]
  df
  df.groupby(pd.Grouper(key="date",freq="5M")).head()

source_raw:
  df = pd.read_csv("dataset.csv")
  df["date"] = pd.to_datetime(df["date"])
  df = df[:32]
  df
  df.groupby(pd.Grouper(key="date",freq="5M")).head()


source:
  df = pd.read_csv("dataset.csv")
  df["date"] = pd.to_datetime(df["date"])
  df = df[:32]
  df
  #df.groupby(pd.Grouper(key="date",freq="5M")).head()

source_raw:
  df = pd.read_csv("dataset.csv")
  df["date"] = pd.to_datetime(df["date"])
  df = df[:32]
  df
  #df.groupby(pd.Grouper(key="date",freq="5M")).head()


source:
  df = pd.read_csv("dataset.csv")
  df["date"] = pd.to_datetime(df["date"])
  df = df[:32]
  df.groupby(pd.Grouper(key="date",freq="10M")).head()

source_raw:
  df = pd.read_csv("dataset.csv")
  df["date"] = pd.to_datetime(df["date"])
  df = df[:32]
  df.groupby(pd.Grouper(key="date",freq="10M")).head()


source:
  df = pd.read_csv("dataset.csv")
  df["date"] = pd.to_datetime(df["date"])
  df = df[:32]
  df.groupby(pd.Grouper(key="date",freq="10m")).head()

source_raw:
  df = pd.read_csv("dataset.csv")
  df["date"] = pd.to_datetime(df["date"])
  df = df[:32]
  df.groupby(pd.Grouper(key="date",freq="10m")).head()


source:
  df = pd.read_csv("dataset.csv")
  df["date"] = pd.to_datetime(df["date"])
  df = df[:32]
  df.groupby(pd.Grouper(key="date",freq="1D")).head()

source_raw:
  df = pd.read_csv("dataset.csv")
  df["date"] = pd.to_datetime(df["date"])
  df = df[:32]
  df.groupby(pd.Grouper(key="date",freq="1D")).head()


source:
  df = pd.read_csv("dataset.csv")
  df["date"] = pd.to_datetime(df["date"])
  df = df[:32]
  df.groupby(pd.Grouper(key="date",freq="1D")).first()

source_raw:
  df = pd.read_csv("dataset.csv")
  df["date"] = pd.to_datetime(df["date"])
  df = df[:32]
  df.groupby(pd.Grouper(key="date",freq="1D")).first()


source:
  df = pd.read_csv("dataset.csv")
  df["date"] = pd.to_datetime(df["date"])
  df = df[:32]
  df.groupby(pd.Grouper(key="date",freq="10M")).first()

source_raw:
  df = pd.read_csv("dataset.csv")
  df["date"] = pd.to_datetime(df["date"])
  df = df[:32]
  df.groupby(pd.Grouper(key="date",freq="10M")).first()


source:
  df = pd.read_csv("dataset.csv")
  df["date"] = pd.to_datetime(df["date"])
  df = df[:32]
  df.groupby(pd.Grouper(key="date",freq="10Min")).first()

source_raw:
  df = pd.read_csv("dataset.csv")
  df["date"] = pd.to_datetime(df["date"])
  df = df[:32]
  df.groupby(pd.Grouper(key="date",freq="10Min")).first()


source:
  df = pd.read_csv("dataset.csv")
  df["date"] = pd.to_datetime(df["date"])
  df = df[:32]
  df = df.groupby(pd.Grouper(key="date",freq="10Min")).first()

source_raw:
  df = pd.read_csv("dataset.csv")
  df["date"] = pd.to_datetime(df["date"])
  df = df[:32]
  df = df.groupby(pd.Grouper(key="date",freq="10Min")).first()


source:
  df = pd.read_csv("dataset.csv")
  df["date"] = pd.to_datetime(df["date"])
  df = df[:7]
  df = df.groupby(pd.Grouper(key="date",freq="10Min")).first()

source_raw:
  df = pd.read_csv("dataset.csv")
  df["date"] = pd.to_datetime(df["date"])
  df = df[:7]
  df = df.groupby(pd.Grouper(key="date",freq="10Min")).first()


source:
  df = pd.read_csv("dataset.csv")
  df["date"] = pd.to_datetime(df["date"])
  df = df[:3]
  df = df.groupby(pd.Grouper(key="date",freq="10Min")).first()

source_raw:
  df = pd.read_csv("dataset.csv")
  df["date"] = pd.to_datetime(df["date"])
  df = df[:3]
  df = df.groupby(pd.Grouper(key="date",freq="10Min")).first()


source:
  df = pd.read_csv("dataset.csv")
  df["date"] = pd.to_datetime(df["date"])
  df = df[:1]
  df = df.groupby(pd.Grouper(key="date",freq="10Min")).first()

source_raw:
  df = pd.read_csv("dataset.csv")
  df["date"] = pd.to_datetime(df["date"])
  df = df[:1]
  df = df.groupby(pd.Grouper(key="date",freq="10Min")).first()


source:
  df = pd.read_csv("dataset.csv")
  df["date"] = pd.to_datetime(df["date"])
  df = df[:2]
  df = df.groupby(pd.Grouper(key="date",freq="10Min")).first()

source_raw:
  df = pd.read_csv("dataset.csv")
  df["date"] = pd.to_datetime(df["date"])
  df = df[:2]
  df = df.groupby(pd.Grouper(key="date",freq="10Min")).first()


source:
  df = pd.read_csv("dataset.csv")
  df["date"] = pd.to_datetime(df["date"])
  df = df.groupby(pd.Grouper(key="date",freq="10Min")).first()

source_raw:
  df = pd.read_csv("dataset.csv")
  df["date"] = pd.to_datetime(df["date"])
  df = df.groupby(pd.Grouper(key="date",freq="10Min")).first()


source:
  df = pd.read_csv("dataset.csv")
  df["date"] = pd.to_datetime(df["date"])
  df = df.groupby(pd.Grouper(key="date",freq="1Y")).first()

source_raw:
  df = pd.read_csv("dataset.csv")
  df["date"] = pd.to_datetime(df["date"])
  df = df.groupby(pd.Grouper(key="date",freq="1Y")).first()


source:
  df = pd.read_csv("dataset.csv")
  df["date"] = pd.to_datetime(df["date"])
  #df = df.groupby(pd.Grouper(key="date",freq="1Y")).first()

source_raw:
  df = pd.read_csv("dataset.csv")
  df["date"] = pd.to_datetime(df["date"])
  #df = df.groupby(pd.Grouper(key="date",freq="1Y")).first()


source:
  df = pd.read_csv("dataset.csv")
  df["date"] = pd.to_datetime(df["date"])
  #df = df.groupby(pd.Grouper(key="date",freq="1Y")).first()
  df.resample('W',  loffset='30Min')

source_raw:
  df = pd.read_csv("dataset.csv")
  df["date"] = pd.to_datetime(df["date"])
  #df = df.groupby(pd.Grouper(key="date",freq="1Y")).first()
  df.resample('W',  loffset='30Min')


source:
  df = pd.read_csv("dataset.csv")
  df["date"] = pd.to_datetime(df["date"])
  df = df.groupby(pd.Grouper(key="date",freq="10M")).first()

source_raw:
  df = pd.read_csv("dataset.csv")
  df["date"] = pd.to_datetime(df["date"])
  df = df.groupby(pd.Grouper(key="date",freq="10M")).first()


source:
  df = pd.read_csv("dataset.csv")
  df["date"] = pd.to_datetime(df["date"])
  df = df[:31]
  df = df.groupby(pd.Grouper(key="date",freq="10Min")).first()

source_raw:
  df = pd.read_csv("dataset.csv")
  df["date"] = pd.to_datetime(df["date"])
  df = df[:31]
  df = df.groupby(pd.Grouper(key="date",freq="10Min")).first()


source:
  #df_month = df.groupby([(df.index.year),(df.index.month),(df.index.day)])
  df_day = df.groupby([(df.index.day),(df.index.month),(df.index.year)])
  df_month.first()

source_raw:
  #df_month = df.groupby([(df.index.year),(df.index.month),(df.index.day)])
  df_day = df.groupby([(df.index.day),(df.index.month),(df.index.year)])
  df_month.first()


source:
  cats = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
  df.groupby(["day_name"])["day_name"].count()
  df['day_name'] = pd.Categorical(df['day_name'], categories=cats, ordered=True)

source_raw:
  cats = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
  df.groupby(["day_name"])["day_name"].count()
  df['day_name'] = pd.Categorical(df['day_name'], categories=cats, ordered=True)


source:
  cats = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
  df.groupby(["day_name"])["day_name"].count()
  df['day_name'] = pd.Categorical(df['day_name'], categories=cats, ordered=True)
  df

source_raw:
  cats = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
  df.groupby(["day_name"])["day_name"].count()
  df['day_name'] = pd.Categorical(df['day_name'], categories=cats, ordered=True)
  df


source:
  cats = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
  df.groupby(["day_name"])["day_name"].count()
  df['day_name'] = pd.Categorical(df['day_name'], categories=cats, ordered=True)
  df.count()

source_raw:
  cats = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
  df.groupby(["day_name"])["day_name"].count()
  df['day_name'] = pd.Categorical(df['day_name'], categories=cats, ordered=True)
  df.count()


source:
  cats = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
  df = df.groupby(["day_name"])["day_name"].count()
  df['day_name'] = pd.Categorical(df['day_name'], categories=cats, ordered=True)

source_raw:
  cats = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
  df = df.groupby(["day_name"])["day_name"].count()
  df['day_name'] = pd.Categorical(df['day_name'], categories=cats, ordered=True)


source:
  cats = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
  df = df.groupby(["day_name"])["day_name"].count()
  pd.Categorical(df['day_name'], categories=cats, ordered=True)

source_raw:
  cats = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
  df = df.groupby(["day_name"])["day_name"].count()
  pd.Categorical(df['day_name'], categories=cats, ordered=True)


source:
  cats = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
  df.groupby(["day_name"])["day_name"].count()
  pd.Categorical(df['day_name'], categories=cats, ordered=True)

source_raw:
  cats = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
  df.groupby(["day_name"])["day_name"].count()
  pd.Categorical(df['day_name'], categories=cats, ordered=True)


source:
  cats = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
  df.groupby(["day_name"])["day_name"].count()
  df["day_name"] = pd.Categorical(df['day_name'], categories=cats, ordered=True)

source_raw:
  cats = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
  df.groupby(["day_name"])["day_name"].count()
  df["day_name"] = pd.Categorical(df['day_name'], categories=cats, ordered=True)


source:
  cats = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
  df.groupby(["day_name"])["day_name"].count()
  df["day_name"] = pd.Categorical(df['day_name'], categories=cats, ordered=True)
  df

source_raw:
  cats = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
  df.groupby(["day_name"])["day_name"].count()
  df["day_name"] = pd.Categorical(df['day_name'], categories=cats, ordered=True)
  df


source:
  cats = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
  newdf = df.groupby(["day_name"])["day_name"].count()
  pd.Categorical(newdf, categories=cats, ordered=True)

source_raw:
  cats = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
  newdf = df.groupby(["day_name"])["day_name"].count()
  pd.Categorical(newdf, categories=cats, ordered=True)


source:
  cats = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
  df = df.groupby(["day_name"])["day_name"].count()
  df["day_name"] = pd.Categorical(newdf, categories=cats, ordered=True)

source_raw:
  cats = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
  df = df.groupby(["day_name"])["day_name"].count()
  df["day_name"] = pd.Categorical(newdf, categories=cats, ordered=True)


source:
  cats = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
  df = df.groupby(["day_name"])["day_name"].count()
  df["day_name"] = pd.Categorical(newdf, categories=cats, ordered=True)
  df = df.sort_values('Date')

source_raw:
  cats = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
  df = df.groupby(["day_name"])["day_name"].count()
  df["day_name"] = pd.Categorical(newdf, categories=cats, ordered=True)
  df = df.sort_values('Date')


source:
  cats = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
  df = df.groupby(["day_name"])["day_name"].count()
  df["day_name"] = pd.Categorical(newdf, categories=cats, ordered=True)
  df = df.sort_values('day_name')

source_raw:
  cats = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
  df = df.groupby(["day_name"])["day_name"].count()
  df["day_name"] = pd.Categorical(newdf, categories=cats, ordered=True)
  df = df.sort_values('day_name')


source:
  df["year"] = df.index.year
  df = df[df["year"] == 2022]
  df["month_name"] = df.index.month_name()
  df.head()

source_raw:
  df["year"] = df.index.year
  df = df[df["year"] == 2022]
  df["month_name"] = df.index.month_name()
  df.head()


source:
  chart = pygal.Bar()
  chart.x_labels = df.index.month_name()
  chart.add("Vim Chat 2022",df)
  chart.render_to_png()

source_raw:
  chart = pygal.Bar()
  chart.x_labels = df.index.month_name()
  chart.add("Vim Chat 2022",df)
  chart.render_to_png()


source:
  chart = pygal.Bar()
  chart.x_labels = df2.month_name
  chart.add("Vim Chat 2022",df2)
  chart.render_to_png()

source_raw:
  chart = pygal.Bar()
  chart.x_labels = df2.month_name
  chart.add("Vim Chat 2022",df2)
  chart.render_to_png()


source:
  chart = pygal.Bar()
  chart.x_labels = df2["month_name"]
  chart.add("Vim Chat 2022",df2)
  chart.render_to_png()

source_raw:
  chart = pygal.Bar()
  chart.x_labels = df2["month_name"]
  chart.add("Vim Chat 2022",df2)
  chart.render_to_png()


source:
  chart = pygal.Bar()
  chart.x_labels = df2["month_name"]
  chart.add("Vim Chat 2022",df2["counts"])
  chart.render_to_png("vim_chat_2022.png")

source_raw:
  chart = pygal.Bar()
  chart.x_labels = df2["month_name"]
  chart.add("Vim Chat 2022",df2["counts"])
  chart.render_to_png("vim_chat_2022.png")


source:
  df2 = df.groupby("month_name")["month_name"].count() .reset_index(name='counts')
  df.sort_values(by='month_name')
  df2.head()

source_raw:
  df2 = df.groupby("month_name")["month_name"].count() .reset_index(name='counts')
  df.sort_values(by='month_name')
  df2.head()


source:
  df2 = df.groupby("month_name")["month_name"].count() .reset_index(name='counts')
  months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", 
            "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
  df['month_name'] = pd.Categorical(df['month_name'], categories=months, ordered=True)
  df.sort_values()
  df2.head()

source_raw:
  df2 = df.groupby("month_name")["month_name"].count() .reset_index(name='counts')
  months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", 
            "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
  df['month_name'] = pd.Categorical(df['month_name'], categories=months, ordered=True)
  df.sort_values()
  df2.head()


source:
  df2 = df.groupby("month_name")["month_name"].count() .reset_index(name='counts')
  months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", 
            "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
  df2['month_name'] = pd.Categorical(df['month_name'], categories=months, ordered=True)
  df2.sort_values()
  df2.head()

source_raw:
  df2 = df.groupby("month_name")["month_name"].count() .reset_index(name='counts')
  months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", 
            "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
  df2['month_name'] = pd.Categorical(df['month_name'], categories=months, ordered=True)
  df2.sort_values()
  df2.head()


source:
  df2 = df.groupby("month_name")["month_name"].count() .reset_index(name='counts')
  months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", 
            "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
  df2['month_name'] = pd.Categorical(df2['month_name'], categories=months, ordered=True)
  df2.sort_values()
  df2.head()

source_raw:
  df2 = df.groupby("month_name")["month_name"].count() .reset_index(name='counts')
  months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", 
            "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
  df2['month_name'] = pd.Categorical(df2['month_name'], categories=months, ordered=True)
  df2.sort_values()
  df2.head()


source:
  df2 = df.groupby("month_name")["month_name"].count() .reset_index(name='counts')
  months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", 
            "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
  df2['month_name'] = pd.Categorical(df2['month_name'], categories=months, ordered=True)
  df2.sort_values(inplace=True)
  df2.head()

source_raw:
  df2 = df.groupby("month_name")["month_name"].count() .reset_index(name='counts')
  months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", 
            "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
  df2['month_name'] = pd.Categorical(df2['month_name'], categories=months, ordered=True)
  df2.sort_values(inplace=True)
  df2.head()


source:
  df2 = df.groupby("month_name")["month_name"].count() .reset_index(name='counts')
  months = {'Jan':1,'Feb':2,'Mar':3, 'Apr':4, 'May':5, 'Jun':6, 'Jul':7, 'Aug':8, 'Sep':9, 'Oct':10, 'Nov':11, 'Dec':12}
  df.sort_values('month_name', key = lambda x : x.apply (lambda x : months[x]))
  df2.head()

source_raw:
  df2 = df.groupby("month_name")["month_name"].count() .reset_index(name='counts')
  months = {'Jan':1,'Feb':2,'Mar':3, 'Apr':4, 'May':5, 'Jun':6, 'Jul':7, 'Aug':8, 'Sep':9, 'Oct':10, 'Nov':11, 'Dec':12}
  df.sort_values('month_name', key = lambda x : x.apply (lambda x : months[x]))
  df2.head()


source:
  df2 = df.groupby("month_name")["month_name"].count() .reset_index(name='counts')
  months = {'Jan':1,'Feb':2,'Mar':3, 'Apr':4, 'May':5, 'Jun':6, 'Jul':7, 'Aug':8, 'Sep':9, 'Oct':10, 'Nov':11, 'Dec':12}
  df2.sort_values('month_name', key = lambda x : x.apply (lambda x : months[x]))
  df2.head()

source_raw:
  df2 = df.groupby("month_name")["month_name"].count() .reset_index(name='counts')
  months = {'Jan':1,'Feb':2,'Mar':3, 'Apr':4, 'May':5, 'Jun':6, 'Jul':7, 'Aug':8, 'Sep':9, 'Oct':10, 'Nov':11, 'Dec':12}
  df2.sort_values('month_name', key = lambda x : x.apply (lambda x : months[x]))
  df2.head()


source:
  df2 = df.groupby("month_name")["month_name"].count() .reset_index(name='counts')
  months = {'Jan':1,'Feb':2,'Mar':3, 'Apr':4, 'May':5, 'Jun':6, 'Jul':7, 'Aug':8, 'Sep':9, 'Oct':10, 'Nov':11, 'Dec':12}
  df2.sort_values('month_name', key = lambda x : x.apply (lambda x : months[x]))
  df2

source_raw:
  df2 = df.groupby("month_name")["month_name"].count() .reset_index(name='counts')
  months = {'Jan':1,'Feb':2,'Mar':3, 'Apr':4, 'May':5, 'Jun':6, 'Jul':7, 'Aug':8, 'Sep':9, 'Oct':10, 'Nov':11, 'Dec':12}
  df2.sort_values('month_name', key = lambda x : x.apply (lambda x : months[x]))
  df2


source:
  df["year"] = df.index.year
  df = df[df["year"] == 2022]
  df["month"] = df.index.month_name()
  df.head()

source_raw:
  df["year"] = df.index.year
  df = df[df["year"] == 2022]
  df["month"] = df.index.month_name()
  df.head()


source:
  df2 = df.groupby("month")["month"].count().reset_index(name='counts')
  df2["month"] = pd.to_datetime(df2.month,format="%B",errors="coerce").dt.month

  df2

source_raw:
  df2 = df.groupby("month")["month"].count().reset_index(name='counts')
  df2["month"] = pd.to_datetime(df2.month,format="%B",errors="coerce").dt.month

  df2


source:
  df2 = df.groupby("month")["month"].count().reset_index(name='counts')
  df2["month"] = pd.to_datetime(df2.month,format="%B",errors="coerce").dt.month_name()

  df2

source_raw:
  df2 = df.groupby("month")["month"].count().reset_index(name='counts')
  df2["month"] = pd.to_datetime(df2.month,format="%B",errors="coerce").dt.month_name()

  df2


source:
  df2 = df.groupby("month")["month"].count().reset_index(name='counts')
  df2["month"] = pd.to_datetime(df2.month,format="%B",errors="coerce").dt.month_name()
  df.sort_values(by="month")
  df2

source_raw:
  df2 = df.groupby("month")["month"].count().reset_index(name='counts')
  df2["month"] = pd.to_datetime(df2.month,format="%B",errors="coerce").dt.month_name()
  df.sort_values(by="month")
  df2


source:
  df2 = df.groupby("month")["month"].count().reset_index(name='counts')
  df2["month"] = pd.to_datetime(df2.month,format="%B",errors="coerce").dt.month_name()
  df2.sort_values(by="month")
  df2

source_raw:
  df2 = df.groupby("month")["month"].count().reset_index(name='counts')
  df2["month"] = pd.to_datetime(df2.month,format="%B",errors="coerce").dt.month_name()
  df2.sort_values(by="month")
  df2


source:
  df["year"] = df.dt.year
  df = df[df["date"].dt.year == 2022]
  df["month"] = df.dt.month_name()
  df.head()

source_raw:
  df["year"] = df.dt.year
  df = df[df["date"].dt.year == 2022]
  df["month"] = df.dt.month_name()
  df.head()


source:
  df2 = df.groupby("month")["month"].count().reset_index(name='counts')
  new_order = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  df2 = df2.reindex(new_order, axis=0)
  df2

source_raw:
  df2 = df.groupby("month")["month"].count().reset_index(name='counts')
  new_order = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  df2 = df2.reindex(new_order, axis=0)
  df2


source:
  df2 = df.groupby("month")["month"].count().reset_index(name='counts')
  months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", 
            "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
  df2.sort_values('month', key = lambda x:pd.Categorical(x, categories=months, ordered=True))

source_raw:
  df2 = df.groupby("month")["month"].count().reset_index(name='counts')
  months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", 
            "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
  df2.sort_values('month', key = lambda x:pd.Categorical(x, categories=months, ordered=True))


source:
  df2 = df.groupby("month")["month"].count().reset_index(name='counts')
  months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun","Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
  df2.sort_values('month', key = lambda x:pd.Categorical(x, categories=months, ordered=True))

source_raw:
  df2 = df.groupby("month")["month"].count().reset_index(name='counts')
  months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun","Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
  df2.sort_values('month', key = lambda x:pd.Categorical(x, categories=months, ordered=True))


source:
  df2 = df.groupby("month")["month"].count().reset_index(name='counts')
  df2["month"] = pd.to_datetime(df2,prefix="%B")
  #months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun","Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
  #df2.sort_values('month', key = lambda x:pd.Categorical(x, categories=months, ordered=True))

source_raw:
  df2 = df.groupby("month")["month"].count().reset_index(name='counts')
  df2["month"] = pd.to_datetime(df2,prefix="%B")
  #months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun","Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
  #df2.sort_values('month', key = lambda x:pd.Categorical(x, categories=months, ordered=True))


source:
  df2 = df.groupby("month")["month"].count().reset_index(name='counts')
  df2["month"] = pd.to_datetime(df2,"%B")
  #months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun","Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
  #df2.sort_values('month', key = lambda x:pd.Categorical(x, categories=months, ordered=True))

source_raw:
  df2 = df.groupby("month")["month"].count().reset_index(name='counts')
  df2["month"] = pd.to_datetime(df2,"%B")
  #months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun","Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
  #df2.sort_values('month', key = lambda x:pd.Categorical(x, categories=months, ordered=True))


source:
  df2 = df.groupby("month")["month"].count().reset_index(name='counts')
  months = ['Jan', 'Feb', 'Mar', 'Apr','May','Jun', 'Jul', 'Aug','Sep', 'Oct', 'Nov', 'Dec']
  df2["month"] = pd.CategoricalIndex(df["month"], categories=cats, ordered=True)
  df2 = df2.sort_index()
  df2
  #df2["month"] = pd.to_datetime(df2,"%B")
  #months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun","Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
  #df2.sort_values('month', key = lambda x:pd.Categorical(x, categories=months, ordered=True))

source_raw:
  df2 = df.groupby("month")["month"].count().reset_index(name='counts')
  months = ['Jan', 'Feb', 'Mar', 'Apr','May','Jun', 'Jul', 'Aug','Sep', 'Oct', 'Nov', 'Dec']
  df2["month"] = pd.CategoricalIndex(df["month"], categories=cats, ordered=True)
  df2 = df2.sort_index()
  df2
  #df2["month"] = pd.to_datetime(df2,"%B")
  #months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun","Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
  #df2.sort_values('month', key = lambda x:pd.Categorical(x, categories=months, ordered=True))


source:
  df2 = df.groupby("month")["month"].count().reset_index(name='counts')
  months = ['Jan', 'Feb', 'Mar', 'Apr','May','Jun', 'Jul', 'Aug','Sep', 'Oct', 'Nov', 'Dec']
  df2["month"] = pd.CategoricalIndex(df["month"], categories=months, ordered=True)
  df2 = df2.sort_index()
  df2
  #df2["month"] = pd.to_datetime(df2,"%B")
  #months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun","Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
  #df2.sort_values('month', key = lambda x:pd.Categorical(x, categories=months, ordered=True))

source_raw:
  df2 = df.groupby("month")["month"].count().reset_index(name='counts')
  months = ['Jan', 'Feb', 'Mar', 'Apr','May','Jun', 'Jul', 'Aug','Sep', 'Oct', 'Nov', 'Dec']
  df2["month"] = pd.CategoricalIndex(df["month"], categories=months, ordered=True)
  df2 = df2.sort_index()
  df2
  #df2["month"] = pd.to_datetime(df2,"%B")
  #months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun","Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
  #df2.sort_values('month', key = lambda x:pd.Categorical(x, categories=months, ordered=True))


source:
  df2 = df.groupby("month")["month"].count().reset_index(name='counts')
  months = ['Jan', 'Feb', 'Mar', 'Apr','May','Jun', 'Jul', 'Aug','Sep', 'Oct', 'Nov', 'Dec']
  df2["month"] = pd.CategoricalIndex(df2["month"], categories=months, ordered=True)
  df2 = df2.sort_index()
  df2
  #df2["month"] = pd.to_datetime(df2,"%B")
  #months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun","Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
  #df2.sort_values('month', key = lambda x:pd.Categorical(x, categories=months, ordered=True))

source_raw:
  df2 = df.groupby("month")["month"].count().reset_index(name='counts')
  months = ['Jan', 'Feb', 'Mar', 'Apr','May','Jun', 'Jul', 'Aug','Sep', 'Oct', 'Nov', 'Dec']
  df2["month"] = pd.CategoricalIndex(df2["month"], categories=months, ordered=True)
  df2 = df2.sort_index()
  df2
  #df2["month"] = pd.to_datetime(df2,"%B")
  #months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun","Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
  #df2.sort_values('month', key = lambda x:pd.Categorical(x, categories=months, ordered=True))


source:
  df2 = df.groupby("month")["month"].count().reset_index(name='counts')
  months = ['Jan', 'Feb', 'Mar', 'Apr','May','Jun', 'Jul', 'Aug','Sep', 'Oct', 'Nov', 'Dec']
  df2.reindex(months)
  #df2["month"] = pd.CategoricalIndex(df2["month"], categories=months, ordered=True)
  #df2 = df2.sort_index()
  #df2
  #df2["month"] = pd.to_datetime(df2,"%B")
  #months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun","Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
  #df2.sort_values('month', key = lambda x:pd.Categorical(x, categories=months, ordered=True))

source_raw:
  df2 = df.groupby("month")["month"].count().reset_index(name='counts')
  months = ['Jan', 'Feb', 'Mar', 'Apr','May','Jun', 'Jul', 'Aug','Sep', 'Oct', 'Nov', 'Dec']
  df2.reindex(months)
  #df2["month"] = pd.CategoricalIndex(df2["month"], categories=months, ordered=True)
  #df2 = df2.sort_index()
  #df2
  #df2["month"] = pd.to_datetime(df2,"%B")
  #months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun","Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
  #df2.sort_values('month', key = lambda x:pd.Categorical(x, categories=months, ordered=True))


source:
  df2 = df.groupby("month")["month"].count().reset_index(name='counts')
  months = ['Jan', 'Feb', 'Mar', 'Apr','May','Jun', 'Jul', 'Aug','Sep', 'Oct', 'Nov', 'Dec']
  df2.reindex(months)
  df2
  #df2["month"] = pd.CategoricalIndex(df2["month"], categories=months, ordered=True)
  #df2 = df2.sort_index()
  #df2
  #df2["month"] = pd.to_datetime(df2,"%B")
  #months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun","Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
  #df2.sort_values('month', key = lambda x:pd.Categorical(x, categories=months, ordered=True))

source_raw:
  df2 = df.groupby("month")["month"].count().reset_index(name='counts')
  months = ['Jan', 'Feb', 'Mar', 'Apr','May','Jun', 'Jul', 'Aug','Sep', 'Oct', 'Nov', 'Dec']
  df2.reindex(months)
  df2
  #df2["month"] = pd.CategoricalIndex(df2["month"], categories=months, ordered=True)
  #df2 = df2.sort_index()
  #df2
  #df2["month"] = pd.to_datetime(df2,"%B")
  #months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun","Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
  #df2.sort_values('month', key = lambda x:pd.Categorical(x, categories=months, ordered=True))


source:
  months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  df2 = df.groupby("month")["month"].count().reset_index(name='counts')
  df2.index = pd.CategoricalIndex(df["month"],categories=months,ordered=True)
  df2

source_raw:
  months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  df2 = df.groupby("month")["month"].count().reset_index(name='counts')
  df2.index = pd.CategoricalIndex(df["month"],categories=months,ordered=True)
  df2


source:
  months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  df2 = df.groupby("month")["month"].count().reset_index(name='counts')
  df2.index = pd.CategoricalIndex(df2["month"],categories=months,ordered=True)
  df2

source_raw:
  months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  df2 = df.groupby("month")["month"].count().reset_index(name='counts')
  df2.index = pd.CategoricalIndex(df2["month"],categories=months,ordered=True)
  df2


source:
  months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  df2 = df.groupby("month")["month"].count().reset_index(name='counts')
  df2.index = pd.CategoricalIndex(df2["month"],categories=months,ordered=True)
  df2 = df2.sort_index().reset_index(drop=True)
  df2

source_raw:
  months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  df2 = df.groupby("month")["month"].count().reset_index(name='counts')
  df2.index = pd.CategoricalIndex(df2["month"],categories=months,ordered=True)
  df2 = df2.sort_index().reset_index(drop=True)
  df2


source:
  color=Style(colors=("red"))
  chart = pygal.Bar(style=color)
  chart.x_labels = df2.month
  chart.add("Vim chat 2022")
  chart.render_to_png("vim_chat_2022.png")

source_raw:
  color=Style(colors=("red"))
  chart = pygal.Bar(style=color)
  chart.x_labels = df2.month
  chart.add("Vim chat 2022")
  chart.render_to_png("vim_chat_2022.png")


source:
  color=Style(colors=("red"))
  chart = pygal.Bar(style=color)
  chart.x_labels = df2.month
  chart.add("Vim chat 2022",df.counts)
  chart.render_to_png("vim_chat_2022.png")

source_raw:
  color=Style(colors=("red"))
  chart = pygal.Bar(style=color)
  chart.x_labels = df2.month
  chart.add("Vim chat 2022",df.counts)
  chart.render_to_png("vim_chat_2022.png")


source:
  color=Style(colors=("red"))
  chart = pygal.Bar(style=color)
  chart.x_labels = df2.month
  chart.add("Vim chat 2022",df2.counts)
  chart.render_to_png("vim_chat_2022.png")

source_raw:
  color=Style(colors=("red"))
  chart = pygal.Bar(style=color)
  chart.x_labels = df2.month
  chart.add("Vim chat 2022",df2.counts)
  chart.render_to_png("vim_chat_2022.png")


source:
  color=Style(colors=("red",))
  chart = pygal.Bar(style=color)
  chart.x_labels = df2.month
  chart.add("Vim chat 2022",df2.counts)
  chart.render_to_png("vim_chat_2022.png")

source_raw:
  color=Style(colors=("red",))
  chart = pygal.Bar(style=color)
  chart.x_labels = df2.month
  chart.add("Vim chat 2022",df2.counts)
  chart.render_to_png("vim_chat_2022.png")


source:
  chart = pygal.Bar()
  chart.x_labels = df2.month
  chart.add("Vim chat 2022",df2.counts)
  chart.render_to_png("vim_chat_2022.png")

source_raw:
  chart = pygal.Bar()
  chart.x_labels = df2.month
  chart.add("Vim chat 2022",df2.counts)
  chart.render_to_png("vim_chat_2022.png")


source:
  # Groupping and sorting by month
  months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  df2 = df.groupby("month")["month"].count().reset_index(name='counts')
  df2.index = pd.CategoricalIndex(df2["month"],categories=months,ordered=True)
  df2 = df2.sort_index().reset_index(drop=True)
  df2

source_raw:
  # Groupping and sorting by month
  months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  df2 = df.groupby("month")["month"].count().reset_index(name='counts')
  df2.index = pd.CategoricalIndex(df2["month"],categories=months,ordered=True)
  df2 = df2.sort_index().reset_index(drop=True)
  df2


source:
  dataframes:list[pd.DataFrame] = []
  years = range(2016,2022)
  for year in years:
      year_df:pd.DataFrame = year_df[df.date.dt.year == year]
      year_df["month"] = df.date.dt.month_namen()
      dataframes.append(year_df)

source_raw:
  dataframes:list[pd.DataFrame] = []
  years = range(2016,2022)
  for year in years:
      year_df:pd.DataFrame = year_df[df.date.dt.year == year]
      year_df["month"] = df.date.dt.month_namen()
      dataframes.append(year_df)


source:
  dataframes:list[pd.DataFrame] = []
  years = range(2016,2022)
  for year in years:
      year_df:pd.DataFrame = df[df.date.dt.year == year]
      year_df["month"] = df.date.dt.month_namen()
      dataframes.append(year_df)

source_raw:
  dataframes:list[pd.DataFrame] = []
  years = range(2016,2022)
  for year in years:
      year_df:pd.DataFrame = df[df.date.dt.year == year]
      year_df["month"] = df.date.dt.month_namen()
      dataframes.append(year_df)


source:
  dataframes:list[pd.DataFrame] = []
  years = range(2016,2022)
  for year in years:
      year_df:pd.DataFrame = df[df.date.dt.year == year]
      year_df["month"] = df.date.dt.month_name()
      dataframes.append(year_df)

source_raw:
  dataframes:list[pd.DataFrame] = []
  years = range(2016,2022)
  for year in years:
      year_df:pd.DataFrame = df[df.date.dt.year == year]
      year_df["month"] = df.date.dt.month_name()
      dataframes.append(year_df)


source:
  dataframes:list[pd.DataFrame] = []
  years = range(2016,2022)
  for year in years:
      year_df:pd.DataFrame = df[df.date.dt.year == year]
      year_df["month"] = year_df.date.dt.month_name()
      dataframes.append(year_df)

source_raw:
  dataframes:list[pd.DataFrame] = []
  years = range(2016,2022)
  for year in years:
      year_df:pd.DataFrame = df[df.date.dt.year == year]
      year_df["month"] = year_df.date.dt.month_name()
      dataframes.append(year_df)


source:
  dataframes:list[pd.DataFrame] = []
  years = range(2016,2022)
  for year in years:
      year_df:pd.DataFrame = df[df.date.dt.year == year]
      #year_df["month"] = year_df.date.dt.month_name()
      dataframes.append(year_df)

source_raw:
  dataframes:list[pd.DataFrame] = []
  years = range(2016,2022)
  for year in years:
      year_df:pd.DataFrame = df[df.date.dt.year == year]
      #year_df["month"] = year_df.date.dt.month_name()
      dataframes.append(year_df)


source:
  dataframes:list[pd.DataFrame] = []
  years = range(2016,2022)
  for year in years:
      year_df = df[df.date.dt.year == year]
      year_df["month"] = year_df.date.dt.month_name()
      dataframes.append(year_df)

source_raw:
  dataframes:list[pd.DataFrame] = []
  years = range(2016,2022)
  for year in years:
      year_df = df[df.date.dt.year == year]
      year_df["month"] = year_df.date.dt.month_name()
      dataframes.append(year_df)


source:
  dataframes:list[pd.DataFrame] = []
  years = range(2016,2022)
  for year in years:
      year_df = df[df.date.dt.year == year]
      #year_df["month"] = year_df.date.dt.month_name()
      dataframes.append(year_df)

source_raw:
  dataframes:list[pd.DataFrame] = []
  years = range(2016,2022)
  for year in years:
      year_df = df[df.date.dt.year == year]
      #year_df["month"] = year_df.date.dt.month_name()
      dataframes.append(year_df)


source:
  dataframes:list[pd.DataFrame] = []
  years = range(2016,2022)
  for year in years:
      year_df = df[df.date.dt.year == year]
      year_df["date"] = pd.to_datetime(year_df["date"])
      year_df["month"] = year_df.date.dt.month_name()
      dataframes.append(year_df)

source_raw:
  dataframes:list[pd.DataFrame] = []
  years = range(2016,2022)
  for year in years:
      year_df = df[df.date.dt.year == year]
      year_df["date"] = pd.to_datetime(year_df["date"])
      year_df["month"] = year_df.date.dt.month_name()
      dataframes.append(year_df)


source:
  dataframes:list[pd.DataFrame] = []
  years = range(2016,2022)
  for year in years:
      year_df = df[df.date.dt.year == year]
      year_df["date"] = pd.to_datetime(year_df["date"])
      year_df["month"] = year_df.date.dt.month_name()
      dataframes.append(year_df)
      year_df = None

source_raw:
  dataframes:list[pd.DataFrame] = []
  years = range(2016,2022)
  for year in years:
      year_df = df[df.date.dt.year == year]
      year_df["date"] = pd.to_datetime(year_df["date"])
      year_df["month"] = year_df.date.dt.month_name()
      dataframes.append(year_df)
      year_df = None


source:
  dataframes:list[pd.DataFrame] = []
  years = range(2016,2022)
  for year in years:
      year_df = df[df.date.dt.year == year]
      #year_df["date"] = pd.to_datetime(year_df["date"])
      #year_df["month"] = year_df.date.dt.month_name()
      dataframes.append(year_df)
      #year_df = None

source_raw:
  dataframes:list[pd.DataFrame] = []
  years = range(2016,2022)
  for year in years:
      year_df = df[df.date.dt.year == year]
      #year_df["date"] = pd.to_datetime(year_df["date"])
      #year_df["month"] = year_df.date.dt.month_name()
      dataframes.append(year_df)
      #year_df = None


source:
  dataframes:list[pd.DataFrame] = []
  years = range(2016,2023)
  for year in years:
      year_df = df[df.date.dt.year == year]
      year_df["month"] = year_df.date.dt.month_name()
      dataframes.append(year_df)
      #year_df = None

source_raw:
  dataframes:list[pd.DataFrame] = []
  years = range(2016,2023)
  for year in years:
      year_df = df[df.date.dt.year == year]
      year_df["month"] = year_df.date.dt.month_name()
      dataframes.append(year_df)
      #year_df = None


source:
  dataframes:list[pd.DataFrame] = []
  years = range(2016,2023)
  for year in years:
      year_df = df[df.date.dt.year == year]
      #year_df["month"] = year_df.date.dt.month_name()
      dataframes.append(year_df)
      #year_df = None

source_raw:
  dataframes:list[pd.DataFrame] = []
  years = range(2016,2023)
  for year in years:
      year_df = df[df.date.dt.year == year]
      #year_df["month"] = year_df.date.dt.month_name()
      dataframes.append(year_df)
      #year_df = None


source:
  dataframes:list[pd.DataFrame] = []
  years = range(2016,2023)
  for year in years:
      year_df = df[df.date.dt.year == year]
      year_df["month"] = "Test" 
      #year_df.date.dt.month_name()
      dataframes.append(year_df)
      #year_df = None

source_raw:
  dataframes:list[pd.DataFrame] = []
  years = range(2016,2023)
  for year in years:
      year_df = df[df.date.dt.year == year]
      year_df["month"] = "Test" 
      #year_df.date.dt.month_name()
      dataframes.append(year_df)
      #year_df = None


source:
  dataframes:list[dict(pd.DataFrame)] = []
  years = range(2016,2023)
  for year in years:
      dataframes[year] = df[df.date.dt.year == year] 
      #year_df["month"] = "Test" 
      #year_df.date.dt.month_name()
      dataframes.append(year_df)
      #year_df = None

source_raw:
  dataframes:list[dict(pd.DataFrame)] = []
  years = range(2016,2023)
  for year in years:
      dataframes[year] = df[df.date.dt.year == year] 
      #year_df["month"] = "Test" 
      #year_df.date.dt.month_name()
      dataframes.append(year_df)
      #year_df = None


source:
  dataframes = []
  years = range(2016,2023)
  for year in years:
      dataframes[year] = df[df.date.dt.year == year] 
      #year_df["month"] = "Test" 
      #year_df.date.dt.month_name()
      dataframes.append(year_df)
      #year_df = None

source_raw:
  dataframes = []
  years = range(2016,2023)
  for year in years:
      dataframes[year] = df[df.date.dt.year == year] 
      #year_df["month"] = "Test" 
      #year_df.date.dt.month_name()
      dataframes.append(year_df)
      #year_df = None


source:
  dataframes = {}
  years = range(2016,2023)
  for year in years:
      dataframes[str(year)] = df[df.date.dt.year == year] 
      #year_df["month"] = "Test" 
      #year_df.date.dt.month_name()
      dataframes.append(year_df)
      #year_df = None

source_raw:
  dataframes = {}
  years = range(2016,2023)
  for year in years:
      dataframes[str(year)] = df[df.date.dt.year == year] 
      #year_df["month"] = "Test" 
      #year_df.date.dt.month_name()
      dataframes.append(year_df)
      #year_df = None


source:
  dataframes = {}
  years = range(2016,2023)
  for year in years:
      dataframes[str(year)] = df[df.date.dt.year == year] 
      #year_df["month"] = "Test" 
      #year_df.date.dt.month_name()
      #dataframes.append(year_df)
      #year_df = None

source_raw:
  dataframes = {}
  years = range(2016,2023)
  for year in years:
      dataframes[str(year)] = df[df.date.dt.year == year] 
      #year_df["month"] = "Test" 
      #year_df.date.dt.month_name()
      #dataframes.append(year_df)
      #year_df = None


source:
  dataframes = {}
  years = range(2016,2023)
  for year in years:
      dataframes[str(year)] = df[df.date.dt.year == year] 
      dataframes(str(year))["month"] = dataframes[str(year)].date.dt.month_name()
      #year_df["month"] = "Test" 
      #year_df.date.dt.month_name()
      #dataframes.append(year_df)
      #year_df = None

source_raw:
  dataframes = {}
  years = range(2016,2023)
  for year in years:
      dataframes[str(year)] = df[df.date.dt.year == year] 
      dataframes(str(year))["month"] = dataframes[str(year)].date.dt.month_name()
      #year_df["month"] = "Test" 
      #year_df.date.dt.month_name()
      #dataframes.append(year_df)
      #year_df = None


source:
  dataframes = {}
  years = range(2016,2023)
  for year in years:
      dataframes[str(year)] = df[df.date.dt.year == year] 
      dataframes[str(year)]["month"] = dataframes[str(year)].date.dt.month_name()
      #year_df["month"] = "Test" 
      #year_df.date.dt.month_name()
      #dataframes.append(year_df)
      #year_df = None

source_raw:
  dataframes = {}
  years = range(2016,2023)
  for year in years:
      dataframes[str(year)] = df[df.date.dt.year == year] 
      dataframes[str(year)]["month"] = dataframes[str(year)].date.dt.month_name()
      #year_df["month"] = "Test" 
      #year_df.date.dt.month_name()
      #dataframes.append(year_df)
      #year_df = None


source:
  # Plot
  chart = pygal.Bar()
  chart.x_labels = df2.month
  chart.add("Vim chat 2022",df2.counts)
  chart.render_to_png("vim_chat_2022.png")

source_raw:
  # Plot
  chart = pygal.Bar()
  chart.x_labels = df2.month
  chart.add("Vim chat 2022",df2.counts)
  chart.render_to_png("vim_chat_2022.png")


source:
  # Plot
  chart = pygal.Bar()
  chart.x_labels = df2.month
  chart.add("Vim chat 2022",df2.counts)
  chart.render_to_png("vim_chat_2016.png")

source_raw:
  # Plot
  chart = pygal.Bar()
  chart.x_labels = df2.month
  chart.add("Vim chat 2022",df2.counts)
  chart.render_to_png("vim_chat_2016.png")


source:
  # Plot
  chart = pygal.Bar()
  chart.x_labels = df2.month
  chart.add("Vim chat 2022",df2.counts)
  chart.render_to_png("vim_chat_2017.png")

source_raw:
  # Plot
  chart = pygal.Bar()
  chart.x_labels = df2.month
  chart.add("Vim chat 2022",df2.counts)
  chart.render_to_png("vim_chat_2017.png")


source:
  # Plot
  chart = pygal.Bar()
  chart.x_labels = df2.month
  chart.add("Vim chat 2017",df2.counts)
  chart.render_to_png("vim_chat_2017.png")

source_raw:
  # Plot
  chart = pygal.Bar()
  chart.x_labels = df2.month
  chart.add("Vim chat 2017",df2.counts)
  chart.render_to_png("vim_chat_2017.png")


source:
  # Plot
  chart = pygal.Bar()
  chart.x_labels = df2.month
  chart.add("Vim chat 2017",df2.counts)
  chart.render()
  #chart.render_to_png("vim_chat_2017.png")

source_raw:
  # Plot
  chart = pygal.Bar()
  chart.x_labels = df2.month
  chart.add("Vim chat 2017",df2.counts)
  chart.render()
  #chart.render_to_png("vim_chat_2017.png")


source:
  # Plot
  chart = pygal.Bar()
  chart.x_labels = df2.month
  chart.add(f"Vim chat {year}",df2.counts)
  chart.render_to_png(f"vim_chat_{year}.png")

source_raw:
  # Plot
  chart = pygal.Bar()
  chart.x_labels = df2.month
  chart.add(f"Vim chat {year}",df2.counts)
  chart.render_to_png(f"vim_chat_{year}.png")


source:
  # Plot
  chart = pygal.Line()
  chart.x_labels = df2.month
  chart.add(f"Vim chat {year}",df2.counts)
  chart.render_to_png(f"vim_chat_{year}.png")

source_raw:
  # Plot
  chart = pygal.Line()
  chart.x_labels = df2.month
  chart.add(f"Vim chat {year}",df2.counts)
  chart.render_to_png(f"vim_chat_{year}.png")


source:
  df = pd.read_csv("hypesquad-beta.csv")
  df["date"] = pd.to_datetime(df["date"],format="%Y-%m-%d %H:%M:%S+00:00")
  df

source_raw:
  df = pd.read_csv("hypesquad-beta.csv")
  df["date"] = pd.to_datetime(df["date"],format="%Y-%m-%d %H:%M:%S+00:00")
  df


source:
  df_2020 = df[df.date.dt.year == "2020"]
  df_2022 = df[df.date.dt.year == "2022"]

  df_2020["month"] = df_2020.date.dt.month_name()
  df_2022["month"] = df_2022.date.dt.month_name()

source_raw:
  df_2020 = df[df.date.dt.year == "2020"]
  df_2022 = df[df.date.dt.year == "2022"]

  df_2020["month"] = df_2020.date.dt.month_name()
  df_2022["month"] = df_2022.date.dt.month_name()


source:
  def group_by_month_name(column:str,dataframe:pd.DataFrame) -> pd.DataFrame:
      months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
      
      dataframe.index = pd.CategoricalIndex(dataframe[column],categories=months,ordered=True)
      dataframe = dataframe.sort_index().reset_index(drop=True)

source_raw:
  def group_by_month_name(column:str,dataframe:pd.DataFrame) -> pd.DataFrame:
      months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
      
      dataframe.index = pd.CategoricalIndex(dataframe[column],categories=months,ordered=True)
      dataframe = dataframe.sort_index().reset_index(drop=True)


source:
  df_2020 = df_2020.groupby("month")["month"].count().reset_index(name='counts')
  df_2022 = df_2022.groupby("month")["month"].count().reset_index(name='counts')

source_raw:
  df_2020 = df_2020.groupby("month")["month"].count().reset_index(name='counts')
  df_2022 = df_2022.groupby("month")["month"].count().reset_index(name='counts')


source:
  count_df_2020 = df_2020.groupby("month")["month"].count().reset_index(name='counts')
  count_df_2022 = df_2022.groupby("month")["month"].count().reset_index(name='counts')

source_raw:
  count_df_2020 = df_2020.groupby("month")["month"].count().reset_index(name='counts')
  count_df_2022 = df_2022.groupby("month")["month"].count().reset_index(name='counts')


source:
  df_2020 = df[df.date.dt.year == "2020"]
  df_2022 = df[df.date.dt.year == "2022"]
  df_2020

  #df_2020["month"] = df_2020.date.dt.month_name()
  #df_2022["month"] = df_2022.date.dt.month_name()

source_raw:
  df_2020 = df[df.date.dt.year == "2020"]
  df_2022 = df[df.date.dt.year == "2022"]
  df_2020

  #df_2020["month"] = df_2020.date.dt.month_name()
  #df_2022["month"] = df_2022.date.dt.month_name()


source:
  df_2020 = df[df.date.dt.year == 2020]
  df_2022 = df[df.date.dt.year == 2022]
  df_2020

  #df_2020["month"] = df_2020.date.dt.month_name()
  #df_2022["month"] = df_2022.date.dt.month_name()

source_raw:
  df_2020 = df[df.date.dt.year == 2020]
  df_2022 = df[df.date.dt.year == 2022]
  df_2020

  #df_2020["month"] = df_2020.date.dt.month_name()
  #df_2022["month"] = df_2022.date.dt.month_name()


source:
  df_2020 = df[df.date.dt.year == 2020]
  df_2022 = df[df.date.dt.year == 2022]

  df_2020["month"] = df_2020.date.dt.month_name()
  df_2022["month"] = df_2022.date.dt.month_name()

source_raw:
  df_2020 = df[df.date.dt.year == 2020]
  df_2022 = df[df.date.dt.year == 2022]

  df_2020["month"] = df_2020.date.dt.month_name()
  df_2022["month"] = df_2022.date.dt.month_name()


source:
  df_2020 = df[df.date.dt.year == 2020]
  df_2022 = df[df.date.dt.year == 2022]
  df_2020
  #df_2020["month"] = df_2020.date.dt.month_name()
  #df_2022["month"] = df_2022.date.dt.month_name()

source_raw:
  df_2020 = df[df.date.dt.year == 2020]
  df_2022 = df[df.date.dt.year == 2022]
  df_2020
  #df_2020["month"] = df_2020.date.dt.month_name()
  #df_2022["month"] = df_2022.date.dt.month_name()


source:
  df_2020 = df[df.date.dt.year == 2020]
  df_2022 = df[df.date.dt.year == 2022]

  df_2020["month"] = df_2020.date.dt.month_name()
  #df_2022["month"] = df_2022.date.dt.month_name()

source_raw:
  df_2020 = df[df.date.dt.year == 2020]
  df_2022 = df[df.date.dt.year == 2022]

  df_2020["month"] = df_2020.date.dt.month_name()
  #df_2022["month"] = df_2022.date.dt.month_name()


source:
  df_2020 = df[df.date.dt.year == 2020]
  df_2022 = df[df.date.dt.year == 2022]

  df_2020.date.dt.month_name()
  #df_2022["month"] = df_2022.date.dt.month_name()

source_raw:
  df_2020 = df[df.date.dt.year == 2020]
  df_2022 = df[df.date.dt.year == 2022]

  df_2020.date.dt.month_name()
  #df_2022["month"] = df_2022.date.dt.month_name()


source:
  df_2020 = df[df.date.dt.year == 2020]
  df_2022 = df[df.date.dt.year == 2022]

  df_2020.date.dt.month_name()[1]
  #df_2022["month"] = df_2022.date.dt.month_name()

source_raw:
  df_2020 = df[df.date.dt.year == 2020]
  df_2022 = df[df.date.dt.year == 2022]

  df_2020.date.dt.month_name()[1]
  #df_2022["month"] = df_2022.date.dt.month_name()


source:
  df_2020 = df[df.date.dt.year == 2020]
  df_2022 = df[df.date.dt.year == 2022]

  df["month"] = df_2020.date.dt.month_name()
  #df_2022["month"] = df_2022.date.dt.month_name()

source_raw:
  df_2020 = df[df.date.dt.year == 2020]
  df_2022 = df[df.date.dt.year == 2022]

  df["month"] = df_2020.date.dt.month_name()
  #df_2022["month"] = df_2022.date.dt.month_name()


source:
  df_2020 = df[df.date.dt.year == 2020]
  df_2022 = df[df.date.dt.year == 2022]

  df_2020 = df_2020.copy()

  df_2020["month"] = df_2020.date.dt.month_name()
  #df_2022["month"] = df_2022.date.dt.month_name()

source_raw:
  df_2020 = df[df.date.dt.year == 2020]
  df_2022 = df[df.date.dt.year == 2022]

  df_2020 = df_2020.copy()

  df_2020["month"] = df_2020.date.dt.month_name()
  #df_2022["month"] = df_2022.date.dt.month_name()


source:
  df_2020 = df[df.date.dt.year == 2020]
  df_2022 = df[df.date.dt.year == 2022]

  df_2020 = df_2020.copy()

  df_2020["month"] = df_2020.date.dt.month_name()
  df_2020
  #df_2022["month"] = df_2022.date.dt.month_name()

source_raw:
  df_2020 = df[df.date.dt.year == 2020]
  df_2022 = df[df.date.dt.year == 2022]

  df_2020 = df_2020.copy()

  df_2020["month"] = df_2020.date.dt.month_name()
  df_2020
  #df_2022["month"] = df_2022.date.dt.month_name()


source:
  df_2020 = df[df.date.dt.year == 2020]
  df_2022 = df[df.date.dt.year == 2022]

  #df_2020 = df_2020.copy()

  df_2020["month"] = df_2020.date.dt.month_name()
  df_2020
  #df_2022["month"] = df_2022.date.dt.month_name()

source_raw:
  df_2020 = df[df.date.dt.year == 2020]
  df_2022 = df[df.date.dt.year == 2022]

  #df_2020 = df_2020.copy()

  df_2020["month"] = df_2020.date.dt.month_name()
  df_2020
  #df_2022["month"] = df_2022.date.dt.month_name()


source:
  df_2020 = df[df.date.dt.year == 2020].copy()
  df_2022 = df[df.date.dt.year == 2022].copy()

  #df_2020 = df_2020.copy()

  df_2020["month"] = df_2020.date.dt.month_name()
  df_2020
  #df_2022["month"] = df_2022.date.dt.month_name()

source_raw:
  df_2020 = df[df.date.dt.year == 2020].copy()
  df_2022 = df[df.date.dt.year == 2022].copy()

  #df_2020 = df_2020.copy()

  df_2020["month"] = df_2020.date.dt.month_name()
  df_2020
  #df_2022["month"] = df_2022.date.dt.month_name()


source:
  df_2020 = df[df.date.dt.year == 2020].copy()
  df_2022 = df[df.date.dt.year == 2022].copy()

  df_2020["month"] = df_2020.date.dt.month_name()
  df_2022["month"] = df_2022.date.dt.month_name()

source_raw:
  df_2020 = df[df.date.dt.year == 2020].copy()
  df_2022 = df[df.date.dt.year == 2022].copy()

  df_2020["month"] = df_2020.date.dt.month_name()
  df_2022["month"] = df_2022.date.dt.month_name()


source:
  df_2021 = df[df.date.dt.year == 2021].copy()
  df_2022 = df[df.date.dt.year == 2022].copy()

  df_2021["month"] = df_2021.date.dt.month_name()
  df_2022["month"] = df_2022.date.dt.month_name()

source_raw:
  df_2021 = df[df.date.dt.year == 2021].copy()
  df_2022 = df[df.date.dt.year == 2022].copy()

  df_2021["month"] = df_2021.date.dt.month_name()
  df_2022["month"] = df_2022.date.dt.month_name()


source:
  df_2020 = df_2021.groupby("month")["month"].count().reset_index(name='counts')
  df_2022 = df_2022.groupby("month")["month"].count().reset_index(name='counts')

source_raw:
  df_2020 = df_2021.groupby("month")["month"].count().reset_index(name='counts')
  df_2022 = df_2022.groupby("month")["month"].count().reset_index(name='counts')


source:
  df_2021 = df_2021.groupby("month")["month"].count().reset_index(name='counts')
  df_2022 = df_2022.groupby("month")["month"].count().reset_index(name='counts')

source_raw:
  df_2021 = df_2021.groupby("month")["month"].count().reset_index(name='counts')
  df_2022 = df_2022.groupby("month")["month"].count().reset_index(name='counts')


source:
  def group_by_month_name(column:str,dataframe:pd.DataFrame) -> pd.DataFrame:
      months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
      
      dataframe.index = pd.CategoricalIndex(dataframe[column],categories=months,ordered=True)
      dataframe = dataframe.sort_index().reset_index(drop=True)
      return dataframe

source_raw:
  def group_by_month_name(column:str,dataframe:pd.DataFrame) -> pd.DataFrame:
      months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
      
      dataframe.index = pd.CategoricalIndex(dataframe[column],categories=months,ordered=True)
      dataframe = dataframe.sort_index().reset_index(drop=True)
      return dataframe


source:
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.add("HypeSquad beta 2021",df_2021)
  chart.add("HypeSquad beta 2022",df_2022)
  chart.render_to_png("HypeSquad_2021_vs_2022.png")

source_raw:
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.add("HypeSquad beta 2021",df_2021)
  chart.add("HypeSquad beta 2022",df_2022)
  chart.render_to_png("HypeSquad_2021_vs_2022.png")


source:
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.add("HypeSquad beta 2021",df_2021)
  chart.add("HypeSquad beta 2022",df_2022)
  #chart.render_to_png("hypeSquad_2021_vs_2022.png")

source_raw:
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.add("HypeSquad beta 2021",df_2021)
  chart.add("HypeSquad beta 2022",df_2022)
  #chart.render_to_png("hypeSquad_2021_vs_2022.png")


source:
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.add("HypeSquad beta 2021",df_2021.counts)
  chart.add("HypeSquad beta 2022",df_2022.counts)
  #chart.render_to_png("hypeSquad_2021_vs_2022.png")

source_raw:
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.add("HypeSquad beta 2021",df_2021.counts)
  chart.add("HypeSquad beta 2022",df_2022.counts)
  #chart.render_to_png("hypeSquad_2021_vs_2022.png")


source:
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.title = "HypeSquad beta 2021 vs 2022"
  chart.add("2021",df_2021.counts)
  chart.add("2022",df_2022.counts)
  #chart.render_to_png("hypeSquad_2021_vs_2022.png")

source_raw:
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.title = "HypeSquad beta 2021 vs 2022"
  chart.add("2021",df_2021.counts)
  chart.add("2022",df_2022.counts)
  #chart.render_to_png("hypeSquad_2021_vs_2022.png")


source:
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.title = "HypeSquad beta 2021 vs 2022"
  chart.add("2021",df_2021.counts)
  chart.add("2022",df_2022.counts)
  chart.render_to_png("hypeSquad_2021_vs_2022.png")

source_raw:
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.title = "HypeSquad beta 2021 vs 2022"
  chart.add("2021",df_2021.counts)
  chart.add("2022",df_2022.counts)
  chart.render_to_png("hypeSquad_2021_vs_2022.png")


source:
  year1 = 2021
  year2 = 2022
  df1 = df[df.date.dt.year == year1].copy()
  df2 = df[df.date.dt.year == year2].copy()

  df1["month"] = df1.date.dt.month_name()
  df2["month"] = df2.date.dt.month_name()

source_raw:
  year1 = 2021
  year2 = 2022
  df1 = df[df.date.dt.year == year1].copy()
  df2 = df[df.date.dt.year == year2].copy()

  df1["month"] = df1.date.dt.month_name()
  df2["month"] = df2.date.dt.month_name()


source:
  df1 = df1.groupby("month")["month"].count().reset_index(name='counts')
  df2 = df2.groupby("month")["month"].count().reset_index(name='counts')

source_raw:
  df1 = df1.groupby("month")["month"].count().reset_index(name='counts')
  df2 = df2.groupby("month")["month"].count().reset_index(name='counts')


source:
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.title = "HypeSquad beta 2021 vs 2022"
  chart.add("2021",df1.counts)
  chart.add("2022",df2.counts)
  chart.render_to_png("hypeSquad_2021_vs_2022.png")

source_raw:
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.title = "HypeSquad beta 2021 vs 2022"
  chart.add("2021",df1.counts)
  chart.add("2022",df2.counts)
  chart.render_to_png("hypeSquad_2021_vs_2022.png")


source:
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.title = "HypeSquad beta 2021 vs 2022"
  chart.add("2021",df1.counts)
  chart.add("2022",df2.counts)
  chart.render_to_png("hypesquad_2021_vs_2022.png")

source_raw:
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.title = "HypeSquad beta 2021 vs 2022"
  chart.add("2021",df1.counts)
  chart.add("2022",df2.counts)
  chart.render_to_png("hypesquad_2021_vs_2022.png")


source:
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.title = "HypeSquad beta 2021 vs 2022"
  chart.add("2021",df1.counts)
  chart.add("2022",df2.counts)
  chart.render_to_png(f"hypesquad_{year1}_vs_{year2}.png")

source_raw:
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.title = "HypeSquad beta 2021 vs 2022"
  chart.add("2021",df1.counts)
  chart.add("2022",df2.counts)
  chart.render_to_png(f"hypesquad_{year1}_vs_{year2}.png")


source:
  df_main["date"] = pd.to_datetime(df_main["date"],format="%Y-%m-%d %H:%M:%S+00:00")
  df_offtopic["date"] = pd.to_datetime(df_offtopic["date"],format="%Y-%m-%d %H:%M:%S+00:00")

source_raw:
  df_main["date"] = pd.to_datetime(df_main["date"],format="%Y-%m-%d %H:%M:%S+00:00")
  df_offtopic["date"] = pd.to_datetime(df_offtopic["date"],format="%Y-%m-%d %H:%M:%S+00:00")


source:
  year = 2021

  df_main = df_main[df_main.date.dt.year == year]
  df_offtopic = df_offtopic[df_offtopic.date.dt.year == year]

source_raw:
  year = 2021

  df_main = df_main[df_main.date.dt.year == year]
  df_offtopic = df_offtopic[df_offtopic.date.dt.year == year]


source:
  year = 2021

  df_main = df_main[df_main.date.dt.year == year].copy()
  df_offtopic = df_offtopic[df_offtopic.date.dt.year == year].copy()

  df_main["month"] = df_main.date.dt.month_name()
  df_offtopic["month"] = df_offtopic.datee.dt.month_name()

source_raw:
  year = 2021

  df_main = df_main[df_main.date.dt.year == year].copy()
  df_offtopic = df_offtopic[df_offtopic.date.dt.year == year].copy()

  df_main["month"] = df_main.date.dt.month_name()
  df_offtopic["month"] = df_offtopic.datee.dt.month_name()


source:
  year = 2021

  df_main = df_main[df_main.date.dt.year == year].copy()
  df_offtopic = df_offtopic[df_offtopic.date.dt.year == year].copy()

  df_main["month"] = df_main.date.dt.month_name()
  df_offtopic["month"] = df_offtopic.date.dt.month_name()

source_raw:
  year = 2021

  df_main = df_main[df_main.date.dt.year == year].copy()
  df_offtopic = df_offtopic[df_offtopic.date.dt.year == year].copy()

  df_main["month"] = df_main.date.dt.month_name()
  df_offtopic["month"] = df_offtopic.date.dt.month_name()


source:
  df_main = df_main.groupby("month")["month"].count().reset_index(name='counts')
  df_offtopic = df_offtopic.groupby("month")["month"].count().reset_index(name='counts')

source_raw:
  df_main = df_main.groupby("month")["month"].count().reset_index(name='counts')
  df_offtopic = df_offtopic.groupby("month")["month"].count().reset_index(name='counts')


source:
  df_main = group_by_month_name("month",df_main)
  df_offtopic = group_by_month_name("month",df_offtopic)

source_raw:
  df_main = group_by_month_name("month",df_main)
  df_offtopic = group_by_month_name("month",df_offtopic)


source:
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.title = "HypeSquad Main VS Offtopic 2021"
  chart.add("Main",df_main.counts)
  chart.add("Offtopic",df_offtopic.counts)

source_raw:
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.title = "HypeSquad Main VS Offtopic 2021"
  chart.add("Main",df_main.counts)
  chart.add("Offtopic",df_offtopic.counts)


source:
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.title = "HypeSquad Main VS Offtopic 2021"
  chart.add("Main",df_main.counts)
  chart.add("Offtopic",df_offtopic.counts)
  chart.render_to_png(f"hypesquad_main_vs_offtopic_{year}.png")

source_raw:
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.title = "HypeSquad Main VS Offtopic 2021"
  chart.add("Main",df_main.counts)
  chart.add("Offtopic",df_offtopic.counts)
  chart.render_to_png(f"hypesquad_main_vs_offtopic_{year}.png")


source:
  year = 2022

  df_main = df_main[df_main.date.dt.year == year].copy()
  df_offtopic = df_offtopic[df_offtopic.date.dt.year == year].copy()

  df_main["month"] = df_main.date.dt.month_name()
  df_offtopic["month"] = df_offtopic.date.dt.month_name()

source_raw:
  year = 2022

  df_main = df_main[df_main.date.dt.year == year].copy()
  df_offtopic = df_offtopic[df_offtopic.date.dt.year == year].copy()

  df_main["month"] = df_main.date.dt.month_name()
  df_offtopic["month"] = df_offtopic.date.dt.month_name()


source:
  # Convert to datetime
  df_main["date"] = pd.to_datetime(df_main["date"],format="%Y-%m-%d %H:%M:%S+00:00")
  df_offtopic["date"] = pd.to_datetime(df_offtopic["date"],format="%Y-%m-%d %H:%M:%S+00:00")

source_raw:
  # Convert to datetime
  df_main["date"] = pd.to_datetime(df_main["date"],format="%Y-%m-%d %H:%M:%S+00:00")
  df_offtopic["date"] = pd.to_datetime(df_offtopic["date"],format="%Y-%m-%d %H:%M:%S+00:00")


source:
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.title = f"HypeSquad Main VS Offtopic {year}"
  chart.add("Main",df_main.counts)
  chart.add("Offtopic",df_offtopic.counts)
  chart.render_to_png(f"hypesquad_main_vs_offtopic_{year}.png")

source_raw:
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.title = f"HypeSquad Main VS Offtopic {year}"
  chart.add("Main",df_main.counts)
  chart.add("Offtopic",df_offtopic.counts)
  chart.render_to_png(f"hypesquad_main_vs_offtopic_{year}.png")


source:
  df["date"] = pd.to_datetime(df["date"],format="%Y-%m-%d %H:%M:%S+00:00")
  df["year"] = df.date.dt.year
  df

source_raw:
  df["date"] = pd.to_datetime(df["date"],format="%Y-%m-%d %H:%M:%S+00:00")
  df["year"] = df.date.dt.year
  df


source:
  df = pd.read_csv("dataset/chat-history.csv")
  df["date"] = pd.to_datetime(df["date"],format="%Y-%m-%d %H:%M:%S+00:00")

source_raw:
  df = pd.read_csv("dataset/chat-history.csv")
  df["date"] = pd.to_datetime(df["date"],format="%Y-%m-%d %H:%M:%S+00:00")


source:
  years = [2022,2021,2020]
  df_list:list[pd.DataFrame]

  for year in years:
      df_list.append(df[df.date.dt.year == year].copy())
  #df1 = df[df.date.dt.year == year1].copy()
  #df2 = df[df.date.dt.year == year2].copy()

  for _df in df_list:
      _df["month"] = _df.date.dt.month_name()

  #df1["month"] = df1.date.dt.month_name()
  #df2["month"] = df2.date.dt.month_name()

source_raw:
  years = [2022,2021,2020]
  df_list:list[pd.DataFrame]

  for year in years:
      df_list.append(df[df.date.dt.year == year].copy())
  #df1 = df[df.date.dt.year == year1].copy()
  #df2 = df[df.date.dt.year == year2].copy()

  for _df in df_list:
      _df["month"] = _df.date.dt.month_name()

  #df1["month"] = df1.date.dt.month_name()
  #df2["month"] = df2.date.dt.month_name()


source:
  years = [2022,2021,2020]
  df_list:list[pd.DataFrame] = []

  for year in years:
      df_list.append(df[df.date.dt.year == year].copy())
  #df1 = df[df.date.dt.year == year1].copy()
  #df2 = df[df.date.dt.year == year2].copy()

  for _df in df_list:
      _df["month"] = _df.date.dt.month_name()

  #df1["month"] = df1.date.dt.month_name()
  #df2["month"] = df2.date.dt.month_name()

source_raw:
  years = [2022,2021,2020]
  df_list:list[pd.DataFrame] = []

  for year in years:
      df_list.append(df[df.date.dt.year == year].copy())
  #df1 = df[df.date.dt.year == year1].copy()
  #df2 = df[df.date.dt.year == year2].copy()

  for _df in df_list:
      _df["month"] = _df.date.dt.month_name()

  #df1["month"] = df1.date.dt.month_name()
  #df2["month"] = df2.date.dt.month_name()


source:
  for _df in df_list:
      df_.groupby("month")["month"].count().reset_index(name="counts")
  #df1 = df1.groupby("month")["month"].count().reset_index(name='counts')
  #df2 = df2.groupby("month")["month"].count().reset_index(name='counts')

source_raw:
  for _df in df_list:
      df_.groupby("month")["month"].count().reset_index(name="counts")
  #df1 = df1.groupby("month")["month"].count().reset_index(name='counts')
  #df2 = df2.groupby("month")["month"].count().reset_index(name='counts')


source:
  for _df in df_list:
      _df.groupby("month")["month"].count().reset_index(name="counts")
  #df1 = df1.groupby("month")["month"].count().reset_index(name='counts')
  #df2 = df2.groupby("month")["month"].count().reset_index(name='counts')

source_raw:
  for _df in df_list:
      _df.groupby("month")["month"].count().reset_index(name="counts")
  #df1 = df1.groupby("month")["month"].count().reset_index(name='counts')
  #df2 = df2.groupby("month")["month"].count().reset_index(name='counts')


source:
  for _df in df_list:
      group_by_month_name("month",_df)
  #df1 = group_by_month_name("month",df1)
  #df2 = group_by_month_name("month",df2)

source_raw:
  for _df in df_list:
      group_by_month_name("month",_df)
  #df1 = group_by_month_name("month",df1)
  #df2 = group_by_month_name("month",df2)


source:
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.title = "HypeSquad beta 2021 vs 2022"
  for i in range(len(years)):
      chart.add(years[i],df_list[i].counts)

  #chart.add("2021",df1.counts)
  #chart.add("2022",df2.counts)
  chart.render_to_png(f"chat_analytics.png")

source_raw:
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.title = "HypeSquad beta 2021 vs 2022"
  for i in range(len(years)):
      chart.add(years[i],df_list[i].counts)

  #chart.add("2021",df1.counts)
  #chart.add("2022",df2.counts)
  chart.render_to_png(f"chat_analytics.png")


source:
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.title = "HypeSquad beta 2021 vs 2022"
  for i in range(len(years)):
      chart.add(years[i],df_list[i].counts)
  df_list[i]
  #chart.add("2021",df1.counts)
  #chart.add("2022",df2.counts)
  chart.render_to_png(f"chat_analytics.png")

source_raw:
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.title = "HypeSquad beta 2021 vs 2022"
  for i in range(len(years)):
      chart.add(years[i],df_list[i].counts)
  df_list[i]
  #chart.add("2021",df1.counts)
  #chart.add("2022",df2.counts)
  chart.render_to_png(f"chat_analytics.png")


source:
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.title = "HypeSquad beta 2021 vs 2022"
  #for i in range(len(years)):
  #   chart.add(years[i],df_list[i].counts)
  df_list[0]
  #chart.add("2021",df1.counts)
  #chart.add("2022",df2.counts)
  chart.render_to_png(f"chat_analytics.png")

source_raw:
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.title = "HypeSquad beta 2021 vs 2022"
  #for i in range(len(years)):
  #   chart.add(years[i],df_list[i].counts)
  df_list[0]
  #chart.add("2021",df1.counts)
  #chart.add("2022",df2.counts)
  chart.render_to_png(f"chat_analytics.png")


source:
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.title = "HypeSquad beta 2021 vs 2022"
  #for i in range(len(years)):
  #   chart.add(years[i],df_list[i].counts)
  df_list[0]
  #chart.add("2021",df1.counts)
  #chart.add("2022",df2.counts)
  #chart.render_to_png(f"chat_analytics.png")

source_raw:
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.title = "HypeSquad beta 2021 vs 2022"
  #for i in range(len(years)):
  #   chart.add(years[i],df_list[i].counts)
  df_list[0]
  #chart.add("2021",df1.counts)
  #chart.add("2022",df2.counts)
  #chart.render_to_png(f"chat_analytics.png")


source:
  df = pd.read_csv("dataset/hypesquad-beta.csv")
  df["date"] = pd.to_datetime(df["date"],format="%Y-%m-%d %H:%M:%S+00:00")
  df

source_raw:
  df = pd.read_csv("dataset/hypesquad-beta.csv")
  df["date"] = pd.to_datetime(df["date"],format="%Y-%m-%d %H:%M:%S+00:00")
  df


source:
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.title = "HypeSquad beta 2021 vs 2022"
  chart.add("2021",df2.counts)
  chart.add("2022",df3.counts)
  chart.render_to_png(f"hypesquad_{year1}_vs_{year2}.png")

source_raw:
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.title = "HypeSquad beta 2021 vs 2022"
  chart.add("2021",df2.counts)
  chart.add("2022",df3.counts)
  chart.render_to_png(f"hypesquad_{year1}_vs_{year2}.png")


source:
  df = pd.read_csv("dataset/chat-history.csv")
  df["date"] = pd.to_datetime(df["date"],format="%Y-%m-%d %H:%M+00:00")

source_raw:
  df = pd.read_csv("dataset/chat-history.csv")
  df["date"] = pd.to_datetime(df["date"],format="%Y-%m-%d %H:%M+00:00")


source:
  df = pd.read_csv("dataset/chat-history.csv")
  df["date"] = pd.to_datetime(df["date"],format="%y-%m-%d %H:%M+00:00")

source_raw:
  df = pd.read_csv("dataset/chat-history.csv")
  df["date"] = pd.to_datetime(df["date"],format="%y-%m-%d %H:%M+00:00")


source:
  df = pd.read_csv("dataset/chat-history.csv")
  df
  df["date"] = pd.to_datetime(df["date"],format="%y-%m-%d %H:%M+00:00")

source_raw:
  df = pd.read_csv("dataset/chat-history.csv")
  df
  df["date"] = pd.to_datetime(df["date"],format="%y-%m-%d %H:%M+00:00")


source:
  df = pd.read_csv("dataset/chat-history.csv")
  df
  #df["date"] = pd.to_datetime(df["date"],format="%y-%m-%d %H:%M+00:00")

source_raw:
  df = pd.read_csv("dataset/chat-history.csv")
  df
  #df["date"] = pd.to_datetime(df["date"],format="%y-%m-%d %H:%M+00:00")


source:
  df = pd.read_csv("dataset/chat-history.csv")
  df
  df["date"] = pd.to_datetime(df["date"],format="%Y-%m-%d %H:%M:%S+00:00")

source_raw:
  df = pd.read_csv("dataset/chat-history.csv")
  df
  df["date"] = pd.to_datetime(df["date"],format="%Y-%m-%d %H:%M:%S+00:00")


source:
  _df = df[df.date.dt.year == 2022]
  _df["week_day_name"] = df.date.dt.day_name()
  _df["month"] = df.date.dt.month_name()
  _df

source_raw:
  _df = df[df.date.dt.year == 2022]
  _df["week_day_name"] = df.date.dt.day_name()
  _df["month"] = df.date.dt.month_name()
  _df


source:
  _df = df[df.date.dt.year == 2022].copy()
  _df["week_day_name"] = df.date.dt.day_name()
  _df["month"] = df.date.dt.month_name()
  _df

source_raw:
  _df = df[df.date.dt.year == 2022].copy()
  _df["week_day_name"] = df.date.dt.day_name()
  _df["month"] = df.date.dt.month_name()
  _df


source:
  _df = df[df.date.dt.year == 2022].copy()
  _df["week_day_name"] = df.date.dt.day_name()
  _df["month"] = df.date.dt.month_name()
  _df.date.dt.day_name()

source_raw:
  _df = df[df.date.dt.year == 2022].copy()
  _df["week_day_name"] = df.date.dt.day_name()
  _df["month"] = df.date.dt.month_name()
  _df.date.dt.day_name()


source:
  df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  df["month_name"] = df.date.dt.month_name()  

source_raw:
  df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  df["month_name"] = df.date.dt.month_name()  


source:
  df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  #df["month_name"] = df.date.dt.month_name()  

source_raw:
  df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  #df["month_name"] = df.date.dt.month_name()  


source:
  #df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  #df["month_name"] = df.date.dt.month_name()  

source_raw:
  #df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  #df["month_name"] = df.date.dt.month_name()  


source:
  df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  df["month"] = df.date.dt.month_name()  

source_raw:
  df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  df["month"] = df.date.dt.month_name()  


source:
  df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  df["month"] = df.date.dt.month_name()  

  df1,df2,df3 = df[df.date.dt.year == [2017,2018,2019]].copy()

source_raw:
  df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  df["month"] = df.date.dt.month_name()  

  df1,df2,df3 = df[df.date.dt.year == [2017,2018,2019]].copy()


source:
  df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  df["month"] = df.date.dt.month_name()  

  [df1,df2,df3] = df[df.date.dt.year == [2017,2018,2019]].copy()

source_raw:
  df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  df["month"] = df.date.dt.month_name()  

  [df1,df2,df3] = df[df.date.dt.year == [2017,2018,2019]].copy()


source:
  df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  df = df[df.date.dt.year == 2022]
  df["month"] = df.date.dt.month_name()  

source_raw:
  df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  df = df[df.date.dt.year == 2022]
  df["month"] = df.date.dt.month_name()  


source:
  df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  df = df[df.date.dt.year == 2022].copy()
  df["month"] = df.date.dt.month_name()  

source_raw:
  df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  df = df[df.date.dt.year == 2022].copy()
  df["month"] = df.date.dt.month_name()  


source:
  df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  df = df[df.date.dt.year == 2017].copy()
  df["month"] = df.date.dt.month_name()  

source_raw:
  df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  df = df[df.date.dt.year == 2017].copy()
  df["month"] = df.date.dt.month_name()  


source:
  def sort_by_month(dataframe:pd.DataFrame,column:str) -> pd.DataFrame:
      months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
      dataframe.index = pd.CategoricalIndex(dataframe[column],categories=months,ordered=True)
      dataframe = dataframe.sort_index().reset_index(drop=True)
      return dataframe

source_raw:
  def sort_by_month(dataframe:pd.DataFrame,column:str) -> pd.DataFrame:
      months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
      dataframe.index = pd.CategoricalIndex(dataframe[column],categories=months,ordered=True)
      dataframe = dataframe.sort_index().reset_index(drop=True)
      return dataframe


source:
  df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  df = df[df.date.dt.year == 2017].copy()
  df["month"] = df.date.dt.month_name()  
  df

source_raw:
  df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  df = df[df.date.dt.year == 2017].copy()
  df["month"] = df.date.dt.month_name()  
  df


source:
  def sort_by_month(dataframe:pd.DataFrame,column:str) -> pd.DataFrame:
      months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
      dataframe.index = pd.CategoricalIndex(dataframe[column],categories=months,ordered=True)
      dataframe = dataframe.sort_index().reset_index(drop=True)
      return dataframe

  df = df.groupby("month")["month"].count().reset_index(name="conts")
  df = sort_by_month(df,"month")
  df

source_raw:
  def sort_by_month(dataframe:pd.DataFrame,column:str) -> pd.DataFrame:
      months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
      dataframe.index = pd.CategoricalIndex(dataframe[column],categories=months,ordered=True)
      dataframe = dataframe.sort_index().reset_index(drop=True)
      return dataframe

  df = df.groupby("month")["month"].count().reset_index(name="conts")
  df = sort_by_month(df,"month")
  df


source:
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.title = "HypeSquad beta 2021 vs 2022"
  chart.add("2021",df.counts)
  chart.render_to_png(f"chat-analytics.png")

source_raw:
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.title = "HypeSquad beta 2021 vs 2022"
  chart.add("2021",df.counts)
  chart.render_to_png(f"chat-analytics.png")


source:
  def sort_by_month(dataframe:pd.DataFrame,column:str) -> pd.DataFrame:
      months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
      dataframe.index = pd.CategoricalIndex(dataframe[column],categories=months,ordered=True)
      dataframe = dataframe.sort_index().reset_index(drop=True)
      return dataframe

  df = df.groupby("month")["month"].count().reset_index(name="counts")
  df = sort_by_month(df,"month")
  df

source_raw:
  def sort_by_month(dataframe:pd.DataFrame,column:str) -> pd.DataFrame:
      months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
      dataframe.index = pd.CategoricalIndex(dataframe[column],categories=months,ordered=True)
      dataframe = dataframe.sort_index().reset_index(drop=True)
      return dataframe

  df = df.groupby("month")["month"].count().reset_index(name="counts")
  df = sort_by_month(df,"month")
  df


source:
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.title = "Chat analytics"
  chart.add(None,df.counts)
  chart.render_to_png(f"chat-analytics.png")

source_raw:
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.title = "Chat analytics"
  chart.add(None,df.counts)
  chart.render_to_png(f"chat-analytics.png")


source:
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.title = "Chat analytics"
  chart.add(None,df.counts)
  chart
  chart.render_to_png(f"chat-analytics.png")

source_raw:
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.title = "Chat analytics"
  chart.add(None,df.counts)
  chart
  chart.render_to_png(f"chat-analytics.png")


source:
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.title = "Chat analytics"
  chart.add(None,df.counts)
  #chart
  #chart.render_to_png(f"chat-analytics.png")

source_raw:
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.title = "Chat analytics"
  chart.add(None,df.counts)
  #chart
  #chart.render_to_png(f"chat-analytics.png")


source:
  # Convert date to datetime & create column month(for month_name)
  df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  df = df[df.date.dt.year == 2017].copy()
  df["month"] = df.date.dt.month_name()  
  df

source_raw:
  # Convert date to datetime & create column month(for month_name)
  df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  df = df[df.date.dt.year == 2017].copy()
  df["month"] = df.date.dt.month_name()  
  df


source:
  # Count month and sort.
  def sort_by_month(dataframe:pd.DataFrame,column:str) -> pd.DataFrame:
      months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
      dataframe.index = pd.CategoricalIndex(dataframe[column],categories=months,ordered=True)
      dataframe = dataframe.sort_index().reset_index(drop=True)
      return dataframe

  df = df.groupby("month")["month"].count().reset_index(name="counts")
  df = sort_by_month(df,"month")
  df

source_raw:
  # Count month and sort.
  def sort_by_month(dataframe:pd.DataFrame,column:str) -> pd.DataFrame:
      months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
      dataframe.index = pd.CategoricalIndex(dataframe[column],categories=months,ordered=True)
      dataframe = dataframe.sort_index().reset_index(drop=True)
      return dataframe

  df = df.groupby("month")["month"].count().reset_index(name="counts")
  df = sort_by_month(df,"month")
  df


source:
  # Create plot
  import pyg
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.title = f"Chat analytics {chat_name}"
  chart.add(None,df.counts)

source_raw:
  # Create plot
  import pyg
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.title = f"Chat analytics {chat_name}"
  chart.add(None,df.counts)


source:
  # Create plot
  import pygal
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.title = f"Chat analytics {chat_name}"
  chart.add(None,df.counts)

source_raw:
  # Create plot
  import pygal
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.title = f"Chat analytics {chat_name}"
  chart.add(None,df.counts)


source:
  get_ipython().run_line_magic('matplotlib', 'inline')
  # Create plot
  import pygal
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.title = f"Chat analytics {chat_name}"
  chart.add(None,df.counts)

source_raw:
  %matplotlib inline
  # Create plot
  import pygal
  chart = pygal.Line()
  chart.x_labels = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
  chart.title = f"Chat analytics {chat_name}"
  chart.add(None,df.counts)


source:
  df = df.groupby(df.date.dt.floor('d')).size().reset_index(name='count')
  df["day_name"] = df.date.dt.day_name()
  df

source_raw:
  df = df.groupby(df.date.dt.floor('d')).size().reset_index(name='count')
  df["day_name"] = df.date.dt.day_name()
  df


source:
  def sort_by_day_name(dataframe:pd.DataFrame,column:str) -> pd.DataFrame:
      day_names = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
      dataframe.index = pd.CategoricalIndex(dataframe[column],categories=day_names,ordered=True)
      dataframe = dataframe.sort_index().reset_index(drop=True)
      return dataframe

  df = df.groupby("day_name")["count"].median()
  df = sort_by_day_name(df,"day_name")

source_raw:
  def sort_by_day_name(dataframe:pd.DataFrame,column:str) -> pd.DataFrame:
      day_names = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
      dataframe.index = pd.CategoricalIndex(dataframe[column],categories=day_names,ordered=True)
      dataframe = dataframe.sort_index().reset_index(drop=True)
      return dataframe

  df = df.groupby("day_name")["count"].median()
  df = sort_by_day_name(df,"day_name")


source:
  def sort_by_day_name(dataframe:pd.DataFrame,column:str) -> pd.DataFrame:
      day_names = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
      dataframe.index = pd.CategoricalIndex(dataframe[column],categories=day_names,ordered=True)
      dataframe = dataframe.sort_index().reset_index(drop=True)
      return dataframe

  df = df.groupby("day_name")["count"].median().reset_indexe(name="count")
  df = sort_by_day_name(df,"day_name")

source_raw:
  def sort_by_day_name(dataframe:pd.DataFrame,column:str) -> pd.DataFrame:
      day_names = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
      dataframe.index = pd.CategoricalIndex(dataframe[column],categories=day_names,ordered=True)
      dataframe = dataframe.sort_index().reset_index(drop=True)
      return dataframe

  df = df.groupby("day_name")["count"].median().reset_indexe(name="count")
  df = sort_by_day_name(df,"day_name")


source:
  def sort_by_day_name(dataframe:pd.DataFrame,column:str) -> pd.DataFrame:
      day_names = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
      dataframe.index = pd.CategoricalIndex(dataframe[column],categories=day_names,ordered=True)
      dataframe = dataframe.sort_index().reset_index(drop=True)
      return dataframe

  df = df.groupby("day_name")["count"].median().reset_index(name="count")
  df = sort_by_day_name(df,"day_name")

source_raw:
  def sort_by_day_name(dataframe:pd.DataFrame,column:str) -> pd.DataFrame:
      day_names = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
      dataframe.index = pd.CategoricalIndex(dataframe[column],categories=day_names,ordered=True)
      dataframe = dataframe.sort_index().reset_index(drop=True)
      return dataframe

  df = df.groupby("day_name")["count"].median().reset_index(name="count")
  df = sort_by_day_name(df,"day_name")


source:
  df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  df = df[df.date.dt.year == 2021]
  df

source_raw:
  df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  df = df[df.date.dt.year == 2021]
  df


source:
  chart = pygal.Line()
  chart.x_labels = df.day_name
  chart.title = "Median count message HypeSquad"
  chart.add(None,df.count)

source_raw:
  chart = pygal.Line()
  chart.x_labels = df.day_name
  chart.title = "Median count message HypeSquad"
  chart.add(None,df.count)


source:
  chart = pygal.Line()
  chart.x_labels = df.day_name
  #chart.title = "Median count message HypeSquad"
  #chart.add(None,df.count)

source_raw:
  chart = pygal.Line()
  chart.x_labels = df.day_name
  #chart.title = "Median count message HypeSquad"
  #chart.add(None,df.count)


source:
  chart = pygal.Line()
  chart.x_labels = df.day_name
  chart.title = "Median count message HypeSquad"
  #chart.add(None,df.count)

source_raw:
  chart = pygal.Line()
  chart.x_labels = df.day_name
  chart.title = "Median count message HypeSquad"
  #chart.add(None,df.count)


source:
  chart = pygal.Line()
  chart.x_labels = df.day_name
  chart.title = "Median count message HypeSquad"
  #chart.add(None,df.count)
  df.count

source_raw:
  chart = pygal.Line()
  chart.x_labels = df.day_name
  chart.title = "Median count message HypeSquad"
  #chart.add(None,df.count)
  df.count


source:
  chart = pygal.Line()
  chart.x_labels = df.day_name
  chart.title = "Median count message HypeSquad"
  chart.add(None,df.count.values)

source_raw:
  chart = pygal.Line()
  chart.x_labels = df.day_name
  chart.title = "Median count message HypeSquad"
  chart.add(None,df.count.values)


source:
  chart = pygal.Line()
  chart.x_labels = df.day_name
  chart.title = "Median count message HypeSquad"
  chart.add(None,df.counts)

source_raw:
  chart = pygal.Line()
  chart.x_labels = df.day_name
  chart.title = "Median count message HypeSquad"
  chart.add(None,df.counts)


source:
  df = df.groupby(df.date.dt.floor('d')).size().reset_index(name='counts')
  df["day_name"] = df.date.dt.day_name()
  df

source_raw:
  df = df.groupby(df.date.dt.floor('d')).size().reset_index(name='counts')
  df["day_name"] = df.date.dt.day_name()
  df


source:
  def sort_by_day_name(dataframe:pd.DataFrame,column:str) -> pd.DataFrame:
      day_names = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
      dataframe.index = pd.CategoricalIndex(dataframe[column],categories=day_names,ordered=True)
      dataframe = dataframe.sort_index().reset_index(drop=True)
      return dataframe

  df = df.groupby("day_name")["counts"].median().reset_index(name="counts")
  df = sort_by_day_name(df,"day_name")

source_raw:
  def sort_by_day_name(dataframe:pd.DataFrame,column:str) -> pd.DataFrame:
      day_names = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
      dataframe.index = pd.CategoricalIndex(dataframe[column],categories=day_names,ordered=True)
      dataframe = dataframe.sort_index().reset_index(drop=True)
      return dataframe

  df = df.groupby("day_name")["counts"].median().reset_index(name="counts")
  df = sort_by_day_name(df,"day_name")


source:
  chart = pygal.Line()
  chart.x_labels = df.day_name
  chart.title = "Median count message HypeSquad 2021"
  chart.add(None,df.counts)

source_raw:
  chart = pygal.Line()
  chart.x_labels = df.day_name
  chart.title = "Median count message HypeSquad 2021"
  chart.add(None,df.counts)


source:
  df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  year = 2022
  df = df[df.date.dt.year == year]
  df

source_raw:
  df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  year = 2022
  df = df[df.date.dt.year == year]
  df


source:
  chart = pygal.Line()
  chart.x_labels = df.day_name
  chart.title = f"Median count message HypeSquad {year}"
  chart.add(None,df.counts)

source_raw:
  chart = pygal.Line()
  chart.x_labels = df.day_name
  chart.title = f"Median count message HypeSquad {year}"
  chart.add(None,df.counts)


source:
  df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  year = 2021
  df = df[df.date.dt.year == year]
  df

source_raw:
  df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  year = 2021
  df = df[df.date.dt.year == year]
  df


source:
  df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  year = 2021
  df_new = df[df.date.dt.year == year].copy()
  df

source_raw:
  df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  year = 2021
  df_new = df[df.date.dt.year == year].copy()
  df


source:
  df_new = df.groupby(df_new.date.dt.floor('d')).size().reset_index(name='counts')
  df_new["day_name"] = df_new.date.dt.day_name()
  df_new

source_raw:
  df_new = df.groupby(df_new.date.dt.floor('d')).size().reset_index(name='counts')
  df_new["day_name"] = df_new.date.dt.day_name()
  df_new


source:
  df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  year = 2021
  df_new = df[df.date.dt.year == year].copy()
  df_new

source_raw:
  df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  year = 2021
  df_new = df[df.date.dt.year == year].copy()
  df_new


source:
  df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  year = 2021
  df_new = df[df.date.dt.year == year].copy()

source_raw:
  df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  year = 2021
  df_new = df[df.date.dt.year == year].copy()


source:
  df_new = df.groupby(df_new.date.dt.floor('d')).size().reset_index(name='counts')
  df_new["day_name"] = df_new.date.dt.day_name()
  df_new.count.sum()

source_raw:
  df_new = df.groupby(df_new.date.dt.floor('d')).size().reset_index(name='counts')
  df_new["day_name"] = df_new.date.dt.day_name()
  df_new.count.sum()


source:
  df_new = df.groupby(df_new.date.dt.floor('d')).size().reset_index(name='counts')
  df_new["day_name"] = df_new.date.dt.day_name()
  df_new.count

source_raw:
  df_new = df.groupby(df_new.date.dt.floor('d')).size().reset_index(name='counts')
  df_new["day_name"] = df_new.date.dt.day_name()
  df_new.count


source:
  df_new = df.groupby(df_new.date.dt.floor('d')).size().reset_index(name='counts')
  df_new["day_name"] = df_new.date.dt.day_name()
  df_new.count()

source_raw:
  df_new = df.groupby(df_new.date.dt.floor('d')).size().reset_index(name='counts')
  df_new["day_name"] = df_new.date.dt.day_name()
  df_new.count()


source:
  df_new = df.groupby(df_new.date.dt.floor('d')).size().reset_index(name='counts')
  df_new["day_name"] = df_new.date.dt.day_name()
  df_new.counts

source_raw:
  df_new = df.groupby(df_new.date.dt.floor('d')).size().reset_index(name='counts')
  df_new["day_name"] = df_new.date.dt.day_name()
  df_new.counts


source:
  df_new = df.groupby(df_new.date.dt.floor('d')).size().reset_index(name='counts')
  df_new["day_name"] = df_new.date.dt.day_name()
  df_new.counts.sum()

source_raw:
  df_new = df.groupby(df_new.date.dt.floor('d')).size().reset_index(name='counts')
  df_new["day_name"] = df_new.date.dt.day_name()
  df_new.counts.sum()


source:
  df_new = df.groupby(df_new.date.dt.floor('d')).size().reset_index(name='counts')
  df_new["day_name"] = df_new.date.dt.day_name()
  df_new.counts.sum() == len(df[df.date.dt.year == year])

source_raw:
  df_new = df.groupby(df_new.date.dt.floor('d')).size().reset_index(name='counts')
  df_new["day_name"] = df_new.date.dt.day_name()
  df_new.counts.sum() == len(df[df.date.dt.year == year])


source:
  # Convert date to datetime & create column month(for month_name)
  df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  df = df[df.date.dt.year == 2017].copy()
  df["month"] = df.date.dt.month_name()  

source_raw:
  # Convert date to datetime & create column month(for month_name)
  df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  df = df[df.date.dt.year == 2017].copy()
  df["month"] = df.date.dt.month_name()  


source:
  # Count month and sort.
  def sort_by_month(dataframe:pd.DataFrame,column:str) -> pd.DataFrame:
      months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
      dataframe.index = pd.CategoricalIndex(dataframe[column],categories=months,ordered=True)
      dataframe = dataframe.sort_index().reset_index(drop=True)
      return dataframe

  df_new = df.groupby("month")["month"].count().reset_index(name="counts")
  df_new = sort_by_month(df,"month")
  len(df_new.counts.sum() == len(df[df.date.year == 2017])

source_raw:
  # Count month and sort.
  def sort_by_month(dataframe:pd.DataFrame,column:str) -> pd.DataFrame:
      months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
      dataframe.index = pd.CategoricalIndex(dataframe[column],categories=months,ordered=True)
      dataframe = dataframe.sort_index().reset_index(drop=True)
      return dataframe

  df_new = df.groupby("month")["month"].count().reset_index(name="counts")
  df_new = sort_by_month(df,"month")
  len(df_new.counts.sum() == len(df[df.date.year == 2017])


source:
  # Count month and sort.
  def sort_by_month(dataframe:pd.DataFrame,column:str) -> pd.DataFrame:
      months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
      dataframe.index = pd.CategoricalIndex(dataframe[column],categories=months,ordered=True)
      dataframe = dataframe.sort_index().reset_index(drop=True)
      return dataframe

  df_new = df.groupby("month")["month"].count().reset_index(name="counts")
  df_new = sort_by_month(df,"month")
  df_new.counts.sum() == len(df[df.date.year == 2017])

source_raw:
  # Count month and sort.
  def sort_by_month(dataframe:pd.DataFrame,column:str) -> pd.DataFrame:
      months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
      dataframe.index = pd.CategoricalIndex(dataframe[column],categories=months,ordered=True)
      dataframe = dataframe.sort_index().reset_index(drop=True)
      return dataframe

  df_new = df.groupby("month")["month"].count().reset_index(name="counts")
  df_new = sort_by_month(df,"month")
  df_new.counts.sum() == len(df[df.date.year == 2017])


source:
  # Count month and sort.
  def sort_by_month(dataframe:pd.DataFrame,column:str) -> pd.DataFrame:
      months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
      dataframe.index = pd.CategoricalIndex(dataframe[column],categories=months,ordered=True)
      dataframe = dataframe.sort_index().reset_index(drop=True)
      return dataframe

  df_new = df.groupby("month")["month"].count().reset_index(name="counts")
  df_new = sort_by_month(df,"month")
  df_new
  #df_new.counts.sum() == len(df[df.date.year == 2017])

source_raw:
  # Count month and sort.
  def sort_by_month(dataframe:pd.DataFrame,column:str) -> pd.DataFrame:
      months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
      dataframe.index = pd.CategoricalIndex(dataframe[column],categories=months,ordered=True)
      dataframe = dataframe.sort_index().reset_index(drop=True)
      return dataframe

  df_new = df.groupby("month")["month"].count().reset_index(name="counts")
  df_new = sort_by_month(df,"month")
  df_new
  #df_new.counts.sum() == len(df[df.date.year == 2017])


source:
  # Convert date to datetime & create column month(for month_name)
  df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  df_new = df[df.date.dt.year == 2017].copy()
  df_new["month"] = df.date.dt.month_name()  

source_raw:
  # Convert date to datetime & create column month(for month_name)
  df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  df_new = df[df.date.dt.year == 2017].copy()
  df_new["month"] = df.date.dt.month_name()  


source:
  # Count month and sort.
  def sort_by_month(dataframe:pd.DataFrame,column:str) -> pd.DataFrame:
      months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
      dataframe.index = pd.CategoricalIndex(dataframe[column],categories=months,ordered=True)
      dataframe = dataframe.sort_index().reset_index(drop=True)
      return dataframe

  df_new = df_new.groupby("month")["month"].count().reset_index(name="counts")
  df_new = sort_by_month(df,"month")
  df_new
  #df_new.counts.sum() == len(df[df.date.year == 2017])

source_raw:
  # Count month and sort.
  def sort_by_month(dataframe:pd.DataFrame,column:str) -> pd.DataFrame:
      months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
      dataframe.index = pd.CategoricalIndex(dataframe[column],categories=months,ordered=True)
      dataframe = dataframe.sort_index().reset_index(drop=True)
      return dataframe

  df_new = df_new.groupby("month")["month"].count().reset_index(name="counts")
  df_new = sort_by_month(df,"month")
  df_new
  #df_new.counts.sum() == len(df[df.date.year == 2017])


source:
  # Count month and sort.
  def sort_by_month(dataframe:pd.DataFrame,column:str) -> pd.DataFrame:
      months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
      dataframe.index = pd.CategoricalIndex(dataframe[column],categories=months,ordered=True)
      dataframe = dataframe.sort_index().reset_index(drop=True)
      return dataframe

  df_new = df_new.groupby("month")["month"].count().reset_index(name="counts")
  df_new = sort_by_month(df_new,"month")
  df_new
  #df_new.counts.sum() == len(df[df.date.year == 2017])

source_raw:
  # Count month and sort.
  def sort_by_month(dataframe:pd.DataFrame,column:str) -> pd.DataFrame:
      months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
      dataframe.index = pd.CategoricalIndex(dataframe[column],categories=months,ordered=True)
      dataframe = dataframe.sort_index().reset_index(drop=True)
      return dataframe

  df_new = df_new.groupby("month")["month"].count().reset_index(name="counts")
  df_new = sort_by_month(df_new,"month")
  df_new
  #df_new.counts.sum() == len(df[df.date.year == 2017])


source:
  # Count month and sort.
  def sort_by_month(dataframe:pd.DataFrame,column:str) -> pd.DataFrame:
      months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
      dataframe.index = pd.CategoricalIndex(dataframe[column],categories=months,ordered=True)
      dataframe = dataframe.sort_index().reset_index(drop=True)
      return dataframe

  df_new = df_new.groupby("month")["month"].count().reset_index(name="counts")
  df_new = sort_by_month(df_new,"month")
  df_new.counts.sum() == len(df[df.date.year == 2017])

source_raw:
  # Count month and sort.
  def sort_by_month(dataframe:pd.DataFrame,column:str) -> pd.DataFrame:
      months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
      dataframe.index = pd.CategoricalIndex(dataframe[column],categories=months,ordered=True)
      dataframe = dataframe.sort_index().reset_index(drop=True)
      return dataframe

  df_new = df_new.groupby("month")["month"].count().reset_index(name="counts")
  df_new = sort_by_month(df_new,"month")
  df_new.counts.sum() == len(df[df.date.year == 2017])


source:
  # Count month and sort.
  def sort_by_month(dataframe:pd.DataFrame,column:str) -> pd.DataFrame:
      months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
      dataframe.index = pd.CategoricalIndex(dataframe[column],categories=months,ordered=True)
      dataframe = dataframe.sort_index().reset_index(drop=True)
      return dataframe

  df_new = df_new.groupby("month")["month"].count().reset_index(name="counts")
  df_new = sort_by_month(df_new,"month")
  df_new.counts.sum() == len(df[df.date.dt.year == 2017])

source_raw:
  # Count month and sort.
  def sort_by_month(dataframe:pd.DataFrame,column:str) -> pd.DataFrame:
      months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
      dataframe.index = pd.CategoricalIndex(dataframe[column],categories=months,ordered=True)
      dataframe = dataframe.sort_index().reset_index(drop=True)
      return dataframe

  df_new = df_new.groupby("month")["month"].count().reset_index(name="counts")
  df_new = sort_by_month(df_new,"month")
  df_new.counts.sum() == len(df[df.date.dt.year == 2017])


source:
  df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  year = 2021
  df = df[df.date.dt.year == year].copy()

source_raw:
  df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  year = 2021
  df = df[df.date.dt.year == year].copy()


source:
  df = df.groupby(df.date.dt.floor('h')).size().reset_index(name='counts')
  df["hour"] = df.date.dt.hour

source_raw:
  df = df.groupby(df.date.dt.floor('h')).size().reset_index(name='counts')
  df["hour"] = df.date.dt.hour


source:
  df_new = df.groupby(df.date.dt.floor('h')).size().reset_index(name='counts')
  df_new["hour"] = df_new.date.dt.hour

source_raw:
  df_new = df.groupby(df.date.dt.floor('h')).size().reset_index(name='counts')
  df_new["hour"] = df_new.date.dt.hour


source:
  df_new = df.groupby(df.date.dt.floor('h')).size().reset_index(name='counts')
  df_new["hour"] = df_new.date.dt.hour
  df_new

source_raw:
  df_new = df.groupby(df.date.dt.floor('h')).size().reset_index(name='counts')
  df_new["hour"] = df_new.date.dt.hour
  df_new


source:
  df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  df_new = df.copy()
  #year = 2021
  #df_new = df[df.date.dt.year == year].copy()

source_raw:
  df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  df_new = df.copy()
  #year = 2021
  #df_new = df[df.date.dt.year == year].copy()


source:
  df_new = df.groupby(df_new.date.dt.floor('d')).size().reset_index(name='counts')
  df_new["day_name"] = df_new.date.dt.day_name()

source_raw:
  df_new = df.groupby(df_new.date.dt.floor('d')).size().reset_index(name='counts')
  df_new["day_name"] = df_new.date.dt.day_name()


source:
  def sort_by_day_name(dataframe:pd.DataFrame,column:str) -> pd.DataFrame:
      day_names = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
      dataframe.index = pd.CategoricalIndex(dataframe[column],categories=day_names,ordered=True)
      dataframe = dataframe.sort_index().reset_index(drop=True)
      return dataframe

  df_new = df_new.groupby("day_name")["counts"].median().reset_index(name="counts")
  df_new = sort_by_day_name(df,"day_name")
  df_new["year"] = df.date.dt.year

source_raw:
  def sort_by_day_name(dataframe:pd.DataFrame,column:str) -> pd.DataFrame:
      day_names = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
      dataframe.index = pd.CategoricalIndex(dataframe[column],categories=day_names,ordered=True)
      dataframe = dataframe.sort_index().reset_index(drop=True)
      return dataframe

  df_new = df_new.groupby("day_name")["counts"].median().reset_index(name="counts")
  df_new = sort_by_day_name(df,"day_name")
  df_new["year"] = df.date.dt.year


source:
  def sort_by_day_name(dataframe:pd.DataFrame,column:str) -> pd.DataFrame:
      day_names = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
      dataframe.index = pd.CategoricalIndex(dataframe[column],categories=day_names,ordered=True)
      dataframe = dataframe.sort_index().reset_index(drop=True)
      return dataframe

  df_new = df_new.groupby("day_name")["counts"].median().reset_index(name="counts")
  df_new = sort_by_day_name(df_new,"day_name")
  df_new["year"] = df.date.dt.year

source_raw:
  def sort_by_day_name(dataframe:pd.DataFrame,column:str) -> pd.DataFrame:
      day_names = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
      dataframe.index = pd.CategoricalIndex(dataframe[column],categories=day_names,ordered=True)
      dataframe = dataframe.sort_index().reset_index(drop=True)
      return dataframe

  df_new = df_new.groupby("day_name")["counts"].median().reset_index(name="counts")
  df_new = sort_by_day_name(df_new,"day_name")
  df_new["year"] = df.date.dt.year


source:
  def sort_by_day_name(dataframe:pd.DataFrame,column:str) -> pd.DataFrame:
      day_names = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
      dataframe.index = pd.CategoricalIndex(dataframe[column],categories=day_names,ordered=True)
      dataframe = dataframe.sort_index().reset_index(drop=True)
      return dataframe

  df_new["year"] = df.date.dt.year
  df_new = df_new.groupby("day_name")["counts"].median().reset_index(name="counts")
  df_new = sort_by_day_name(df_new,"day_name")

source_raw:
  def sort_by_day_name(dataframe:pd.DataFrame,column:str) -> pd.DataFrame:
      day_names = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
      dataframe.index = pd.CategoricalIndex(dataframe[column],categories=day_names,ordered=True)
      dataframe = dataframe.sort_index().reset_index(drop=True)
      return dataframe

  df_new["year"] = df.date.dt.year
  df_new = df_new.groupby("day_name")["counts"].median().reset_index(name="counts")
  df_new = sort_by_day_name(df_new,"day_name")


source:
  df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  df = df[df.date.dt.year == 2021].copy()

source_raw:
  df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  df = df[df.date.dt.year == 2021].copy()


source:
  df = df.groupby(df.date.dt.floor('d')).size().reset_index(name='counts')
  df["day_name"] = df.date.dt.day_name()

source_raw:
  df = df.groupby(df.date.dt.floor('d')).size().reset_index(name='counts')
  df["day_name"] = df.date.dt.day_name()


source:
  chart = pygal.Line()
  chart.x_labels = df.day_name
  chart.title = f"Average message count per day - HypeSquad - {year}"
  chart.add(None,df.counts)

source_raw:
  chart = pygal.Line()
  chart.x_labels = df.day_name
  chart.title = f"Average message count per day - HypeSquad - {year}"
  chart.add(None,df.counts)


source:
  df = df.groupby(df.date.dt.floor('h')).size().reset_index(name='counts')
  df["hour"] = df.date.dt.day_name()

source_raw:
  df = df.groupby(df.date.dt.floor('h')).size().reset_index(name='counts')
  df["hour"] = df.date.dt.day_name()


source:
  df = df.groupby("hour")["counts"].median().reset_index(name="counts")
  df = sort_by_day_name(df,"hour")

source_raw:
  df = df.groupby("hour")["counts"].median().reset_index(name="counts")
  df = sort_by_day_name(df,"hour")


source:
  df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  year = 2021
  df = df[df.date.dt.year == year].copy()
  df

source_raw:
  df.date = pd.to_datetime(df.date,format="%Y-%m-%d %H:%M:%S+00:00")
  year = 2021
  df = df[df.date.dt.year == year].copy()
  df


source:
  df = df.groupby(df.date.dt.floor('h')).size().reset_index(name='counts')
  df["hour"] = df.date.dt.hour()

source_raw:
  df = df.groupby(df.date.dt.floor('h')).size().reset_index(name='counts')
  df["hour"] = df.date.dt.hour()


source:
  df["hour"] = df.date.dt.hour
  df = df.groupby("hour")["counts"].median().reset_index(name="counts")
  df

source_raw:
  df["hour"] = df.date.dt.hour
  df = df.groupby("hour")["counts"].median().reset_index(name="counts")
  df


source:
  df = df.groupby(df.date.dt.floor('h')).size().reset_index(name='counts')
  df["hour"] = df.date.dt.hour
  df = df.groupby("hour")["counts"].median().reset_index(name="counts")
  df

source_raw:
  df = df.groupby(df.date.dt.floor('h')).size().reset_index(name='counts')
  df["hour"] = df.date.dt.hour
  df = df.groupby("hour")["counts"].median().reset_index(name="counts")
  df


source:
  chart = pygal.Line()
  chart.x_labels = df.hour
  chart.title = f"Average message count per day - {year}"
  chart.add(None,df.counts)

source_raw:
  chart = pygal.Line()
  chart.x_labels = df.hour
  chart.title = f"Average message count per day - {year}"
  chart.add(None,df.counts)


source:
  chart = pygal.Line()
  chart.x_labels = df.hour
  chart.title = f"Average message count per hour - {year}"
  chart.add(None,df.counts)

source_raw:
  chart = pygal.Line()
  chart.x_labels = df.hour
  chart.title = f"Average message count per hour - {year}"
  chart.add(None,df.counts)


source:
  chart = pygal.Line()
  chart.x_labels = df.day_name
  chart.title = f"Average message count per day - {year}"
  chart.add(None,df.counts)

source_raw:
  chart = pygal.Line()
  chart.x_labels = df.day_name
  chart.title = f"Average message count per day - {year}"
  chart.add(None,df.counts)


