code: def shannon_entropy(time_series):
      
  
      # Check if string
      if not isinstance(time_series, str):
          time_series = list(time_series)
  
      # Create a frequency data
      data_set = list(set(time_series))
      freq_list = []
      for entry in data_set:
          counter = 0.
          for i in time_series:
              if i == entry:
                  counter += 1
          freq_list.append(float(counter) / len(time_series))
  
      # Shannon entropy
      ent = 0.0
      for freq in freq_list:
          ent += freq * np.log2(freq)
      ent = -ent
      return ent
docs: Return the Shannon Entropy of the sample data.
  
      Args:
          time_series: Vector or string of the sample data
  
      Returns:
          The Shannon Entropy as float value