docs: def tsam_cluster(timeseries_df, typical_periods=10, how='daily'):
      """
      Parameters
      ----------
      df : pd.DataFrame
          DataFrame with timeseries to cluster
  
      Returns
      -------
      timeseries : pd.DataFrame
          Clustered timeseries
      """
  
      if how == 'daily':
          hours = 24
      if how == 'weekly':
          hours = 168
  
      aggregation = tsam.TimeSeriesAggregation(
          timeseries_df,
          noTypicalPeriods=typical_periods,
          rescaleClusterPeriods=False,
          hoursPerPeriod=hours,
          clusterMethod='hierarchical')
  
      timeseries = aggregation.createTypicalPeriods()
      cluster_weights = aggregation.clusterPeriodNoOccur
  
      # get the medoids/ the clusterCenterIndices
      clusterCenterIndices = aggregation.clusterCenterIndices
  
      # get all index for every hour of that day of the clusterCenterIndices
      start = []
      # get the first hour of the clusterCenterIndices (days start with 0)
      for i in clusterCenterIndices:
          start.append(i * hours)
  
      # get a list with all hours belonging to the clusterCenterIndices
      nrhours = []
      for j in start:
          nrhours.append(j)
          x = 1
          while x < hours:
              j = j + 1
              nrhours.append(j)
              x = x + 1
  
      # get the origial Datetimeindex
      dates = timeseries_df.iloc[nrhours].index
  
      return timeseries, cluster_weights, dates, hours