From 9c28bbec839f63a5ee7c61dc8d4d0a3a56683f71 Mon Sep 17 00:00:00 2001 From: brotherzhafif Date: Sat, 12 Oct 2024 12:29:39 +0700 Subject: [PATCH] Finishing New Documentation and Code Comments --- FrequencyTable.py | 16 ++++---------- Main.py | 14 ++++++------ README.md | 54 ++++++++++++++++++++++++++++++++--------------- 3 files changed, 49 insertions(+), 35 deletions(-) diff --git a/FrequencyTable.py b/FrequencyTable.py index da40962..cdee365 100644 --- a/FrequencyTable.py +++ b/FrequencyTable.py @@ -56,16 +56,9 @@ def Populate(self): # Adding Data Range Limit Of The Class Frequency data_limit.append(str(old_number - 0.5) + " ~ " + str(current_number + 0.5)) - - # Assign Value Each Processed Data - self.bottom_limit = lower - self.top_limit = upper - self.frequency = frequency - self.ranges = data_range - self.limit = data_limit # Append Processed Data into Data Attributes - self.data = ProcessedData(self.bottom_limit, self.top_limit, self.frequency, self.ranges, self.limit) + self.data = ProcessedData(lower, upper, frequency, data_range, data_limit) # Base 5 Rounding def roundy(self, x, base = 5): @@ -83,7 +76,6 @@ class ProcessedData: def __init__(self, bottoms, tops, frequency, ranges, limit): self.bottom = bottoms self.top = tops - self.frequency = frequency # frekuensi terproses - self.ranges = ranges # rentang terproses - self.limit = limit # batas kelas terproses - + self.frequency = frequency + self.ranges = ranges + self.limit = limit diff --git a/Main.py b/Main.py index e99d321..7a5c79d 100644 --- a/Main.py +++ b/Main.py @@ -1,6 +1,7 @@ +# EXAMPLE PROGRAM import FrequencyTable as ft - -# Misalnya, Anda punya data mentah seperti ini: + +# Raw Data data = ( 58, 67, 45, 89, 72, 60, 76, 93, 55, 48, 62, 85, 79, 56, 41, 90, @@ -9,11 +10,12 @@ 49, 87, 88, 50, 69, 84, 43, 65, 83, 70, 44, 61, 75, 80, 71, 63, 47,51) -# Membuat objek dari FrequencyTable dengan data mentah +# Initiate Object From The Raw Data table = ft.FrequencyTable(data) -# Memproses data mentah menjadi tabel frekuensi +# Processing Raw Data to Frequency Table table.Populate() -print(table.data.ranges) # Output: [0, 10, 20, 30] (data terproses) -print(table.data.frequency) # Output: [10, 20, 30, 40] (data terproses) +# Print The Data +print(table.data.ranges) +print(table.data.frequency) diff --git a/README.md b/README.md index 43bc22c..fe7de53 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ - Matplotlib pip install matplotlib + - Numpy pip install numpy @@ -12,42 +13,61 @@ ### Structure - Program Structure - + Main.py [ Main execute file ] - + Dataset.py [ Place to put the Dataset ] - + Frequency.py [ Frequency Table Module ] + + Main.py [ Main Control file ] + + FrequencyTable.py [ Frequency Table Module ] + Chart.py [ Chart Display Module ] ### Module -- Frequency.py Variables Description +- FrequencyTable.py Variables Description - # Data Needed For Frequency Table + # Raw Data Needed For Frequency Table + dataset = sorted dataset from your main.py input amount = amount/length of data - dataset = the dataset from Dataset.py lowest = minimum dataset value highest = maximum dataset value - ranges = amount dataset range + range = amount dataset range ( all dataset value ) classes = amount of dataset class interval = amount of interval for each frequency base = frequency table bottom data start point - top = frequency table top data stop point - - # Processed Frequency Table Data - data_lower = each bottom data limit of each dataset class - data_upper = each top data limit of each dataset class - data_frequency = frequency for each dataset class - data_range = combination of data_lower and data_upper showing the data frequency range - + top = frequency table top data stop point + # Processed Frequency Table Data + data = the main class for processed data + data.bottom = each bottom data limit of each dataset class + data.top = each top data limit of each dataset class + data.frequency = frequency for each dataset class + data.range = combination of data.top and data.bottom showing the data frequency range + data.limit = data range bottom and top limit ### How to run - Clone This Repositry -> Pythistic Folder git clone https://github.com/brotherzhafif/Pythistic.git cd Pythistic -- Open Dataset.py -> paste your 1D array data + +- Open Main.py -> paste your 1D array data into data variable # Example - data = (1,3,6,8,4) + import FrequencyTable as ft + + data = ( + 58, 67, 45, 89, 72, 60, 76, 93, + 55, 48, 62, 85, 79, 56, 41, 90, + 77, 54, 68, 82, 46, 73, 57, 92, + 81, 53, 66, 74, 64, 52, 91, 78, + 49, 87, 88, 50, 69, 84, 43, 65, + 83, 70, 44, 61, 75, 80, 71, 63, 47,51) + + # Initiate Object From The Raw Data + table = ft.FrequencyTable(data) + + # Processing Raw Data to Frequency Table + table.Populate() + + # Print The Data + print(table.data.ranges) + print(table.data.frequency) + - Run the Main.py python Main.py # for universal python distribution