From 17c049fbfd18790154dc9813a5c5436844a593d5 Mon Sep 17 00:00:00 2001 From: redoules Date: Wed, 7 Nov 2018 23:56:54 +0100 Subject: [PATCH] added blog article day0 statistics --- blog/Statistics_10days-day0.html | 231 ++++++++++++++++++ .../Installing_bitcoind_on_raspberry_pi.html | 2 +- cryptocurrencies/blockchain_bad.html | 2 +- index.html | 4 +- jupyter/clear_cell.html | 2 +- jupyter/remote_run_notebook.html | 2 +- linux/Reloading_.bashrc.html | 2 +- linux/Reloading_fstab.html | 2 +- linux/bashrc.html | 2 +- linux/directory_size.html | 2 +- linux/free_disk_space_linux.html | 2 +- linux/get_ip_linux.html | 2 +- linux/linux_process_information.html | 2 +- linux/mount_nfs_share_fstab.html | 2 +- linux/share_nfs_share.html | 2 +- linux/simple_bash_function.html | 2 +- linux/version_kernel.html | 2 +- ...he recommandation engine for articles.html | 2 +- mathematics/Number_edges_Complete_graph.html | 2 +- pages/about.html | 2 +- python/Creating_a_sqlite_database.html | 2 +- ...of_eigenvalues_from_a_list_of_tensors.html | 2 +- python/Iterating_over_a_dataframe.html | 2 +- python/Moving_average_pandas.html | 2 +- python/Opening_SQLite_database.html | 2 +- python/Opening_file.html | 2 +- python/Optimized_numpy_random_intel.html | 2 +- ..._data_from_a_sql_database_with_pandas.html | 2 +- ...plotlib_figure_with_a_high_resolution.html | 2 +- ...notebook_for_plotting_with_matplotlib.html | 2 +- ...ng_data_to_a_sql_database_with_pandas.html | 2 +- python/counting.html | 2 +- python/dask_distributed_parallelism.html | 2 +- python/dask_infiniband.html | 2 +- python/design_own_libs.html | 2 +- python/dict_comprehension.html | 2 +- python/download_page.html | 2 +- python/ensure_dir.html | 2 +- python/list_files_directory.html | 2 +- python/logplot.html | 2 +- python/reverse.html | 2 +- python/sorting.html | 2 +- python/stock_pandas.html | 2 +- python/unique.html | 2 +- ...ting_all_python_package_with_anaconda.html | 2 +- search.html | 2 +- sitemap.xml | 9 +- sql/Sorting_results.html | 2 +- sql/WHERE_SQL_keywords.html | 2 +- sql/display_table.html | 2 +- sql/display_table_filter.html | 2 +- tipuesearch_content.json | 2 +- 52 files changed, 290 insertions(+), 52 deletions(-) create mode 100644 blog/Statistics_10days-day0.html diff --git a/blog/Statistics_10days-day0.html b/blog/Statistics_10days-day0.html new file mode 100644 index 0000000..297c467 --- /dev/null +++ b/blog/Statistics_10days-day0.html @@ -0,0 +1,231 @@ + + + + + + + + + + + + + [10 Days of Statistics] Day 0 - Median, mean, mode and weighted mean - Blog + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+

+ [10 Days of Statistics] Day 0 - Median, mean, mode and weighted mean +

+ +
+
+

A reminder

+

The median

+

The median is the value separating the higher half from the lower half of a data sample. For a data set, it may be thought of as the middle value. +For a continuous probability distribution, the median is the value such that a number is equally likely to fall above or below it.

+

The mean

+

The arithmetic mean (or simply mean) of a sample is the sum of the sampled values divided by the number of items.

+

The mode

+

The mode of a set of data values is the value that appears most often. It is the value x at which its probability mass function takes its maximum value. In other words, it is the value that is most likely to be sampled.

+

Implementation in python without using the scientific libraries

+
def median(l):
+    l = sorted(l)
+    return (l[len(l) // 2] + l[(len(l)//2 - 1)]) / 2
+
+def mean(l):
+    return sum(l)/len(l)
+
+def mode(data):
+    dico = {x:data.count(x) for x in list(set(data))}
+    return sorted(sorted(dico.items()), key = lambda x: x[1], reverse = True)[0][0]
+
+ + +
L = [64630,11735,14216,99233,14470,4978,73429,38120,51135,67060, 4978, 73429]
+print(f"Sample : {L}\nMean : {mean(L)}, Median : {median(L)}, Mode : {mode(L)}")
+
+ + +
Sample : [64630, 11735, 14216, 99233, 14470, 4978, 73429, 38120, 51135, 67060, 4978, 73429]
+Mean : 43117.75, Median : 44627.5, Mode : 4978
+
+ + +

The weighted average

+

The weighted arithmetic mean is similar to an ordinary arithmetic mean (the most common type of average), except that instead of each of the data points contributing equally to the final average, some data points contribute more than others.

+
data = [10,40,30,50,20]
+weights = [1,2,3,4,5]
+sum_X = sum([x*w for x,w in zip(data,weights)])
+print(round((sum_X/sum(weights)),1))
+
+ + +
32.0
+
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/cryptocurrencies/Installing_bitcoind_on_raspberry_pi.html b/cryptocurrencies/Installing_bitcoind_on_raspberry_pi.html index 2415165..18cbf96 100644 --- a/cryptocurrencies/Installing_bitcoind_on_raspberry_pi.html +++ b/cryptocurrencies/Installing_bitcoind_on_raspberry_pi.html @@ -286,7 +286,7 @@ maxuploadtarget=5000