Weekly Challenges

Solve the challenge, share your solution and summit the ranks of our Community!

Also available in | Français | Português | Español | 日本語
IDEAS WANTED

Want to get involved? We're always looking for ideas and content for Weekly Challenges.

SUBMIT YOUR IDEA

Challenge #141: Examination Data Simulation

mmontgomery
11 - Bolide

Challenge #141

JamesCharnley
13 - Pulsar
Spoiler
JamesCharnley_0-1657209091029.png

 

Felt very intimidating to start but just clicking around I ended up learning about a brilliant tool I had no idea existed before!

MilindG
12 - Quasar
Spoiler
MilindG_0-1659728807665.png

 

acarter881
12 - Quasar

This one is tough - I'm not 100% sure if this is correct, but I decided to do it in Python.

Spoiler
import pandas as pd
import random
import matplotlib.pyplot as plt 

class Alteryx:
    def __init__(self, excel_fp) -> None:
        # File path for the Excel workbook that contains the First name, Last name, and Email address
        self.excel_fp = excel_fp

        # Store the randomly generated numbers
        self.numbers = list()

        # Average
        self.mean = 70

        # Standard deviation
        self.sigma = 5

    def read_excel(self) -> None:
        """
        DataFrame that has:
            1. First name
            2. Last name
            3. Email address
        """ 
        self.df = pd.read_excel(io=self.excel_fp, header=0, keep_default_na=True)

    def gaussian(self) -> None:
        for _ in range(len(self.df['First'])):
            temp = random.gauss(mu=self.mean, sigma=self.sigma)
            self.numbers.append(temp)

    def append_and_save_scores(self) -> None:
        # Add the columns with the scores to the DataFrame
        self.df['scores'] = self.numbers

        # Save the DataFrame to an Excel workbook
        self.df.to_excel('./main stuff/output.xlsx', index=False)
        
    def plot(self) -> None:
        # Labels
        fig = plt.figure()
        ax1 = fig.add_subplot(211)
        ax1.set_ylabel('Count')
        ax1.set_xlabel('Number')
        ax1.set_title('Alteryx Weekly Challenge #141')

        # Histogram
        plt.hist(x=self.numbers, bins=50)

        # Show the histogram
        plt.show()

# Instantiate class and call functions
if __name__ == '__main__':
    c = Alteryx(excel_fp='./main stuff/test_input.xlsx')
    c.read_excel()
    c.gaussian()
    c.append_and_save_scores()
    c.plot()

The result:

Figure_1.png

martinding
13 - Pulsar

Very intuitive to configure! Nice tool!

Spoiler
141.png

TungThanhHo
8 - Asteroid

my solution

ahsanaali
11 - Bolide
Spoiler
ahsanaali_0-1668361429763.png

 

FinnCharlton
13 - Pulsar
Spoiler
FinnCharlton_0-1671451379165.png

 

kristiadiuisan
8 - Asteroid

Simulation Sampling tool is key

Spoiler
Alteryx_challenge_141_KU.png
CeliaC_Silje
8 - Asteroid
Spoiler
CeliaC_Silje_0-1681366337005.png