import numpy as np

# Generate an array of 100 random numbers between 0 and 1
D = np.random.uniform(0, 1, 100)

# Generate an array of 100 random integers between 0 and 9
S = np.random.randint(0, 10, 100)

# Sum the D values for each unique value in S, weighted by their frequency
D_sums = np.bincount(S, weights=D)

# Count the number of occurrences of each value in S
D_counts = np.bincount(S)

# Calculate the mean of the D values for each unique value in S
D_means = np.zeros(len(D_counts))
for i in np.arange(len(D_counts)):
    if D_counts[i] != 0:
        D_means[i] = D_sums[i] / D_counts[i]

# Print the mean of the D values for each unique value in S
print(D_means)