diff --git a/2020.06.01_parallel_calculations_with_python/application_of_parallel_calculations_with_python.py b/2020.06.01_parallel_calculations_with_python/application_of_parallel_calculations_with_python.py index 2267f25..251b9d7 100644 --- a/2020.06.01_parallel_calculations_with_python/application_of_parallel_calculations_with_python.py +++ b/2020.06.01_parallel_calculations_with_python/application_of_parallel_calculations_with_python.py @@ -1,3 +1,8 @@ +""" +This code is supported by the website: https://www.guanjihuan.com +The newest version of this code is on the web page: https://www.guanjihuan.com/archives/4536 +""" + from multiprocessing import Process import os import time @@ -14,12 +19,12 @@ def main(parameter_array, task_index): guan.write_one_dimensional_data(parameter_array, result_array, filename='task_index='+str(task_index)) if __name__ == '__main__': - cpus = 4 + task_num = 4 parameter_array_all = np.arange(0, 17, 1) start_time = time.perf_counter() process_array = [] - for task_index in range(cpus): - parameter_array = guan.preprocess_for_parallel_calculations(parameter_array_all, cpus, task_index) + for task_index in range(task_num): + parameter_array = guan.preprocess_for_parallel_calculations(parameter_array_all, task_num, task_index) process_array.append(Process(target=main, args=(parameter_array, task_index))) for process in process_array: # 运行子进程 process.start() @@ -28,7 +33,7 @@ if __name__ == '__main__': end_time = time.perf_counter() print('运行时间=', (end_time-start_time), '\n') f = open('result.txt', 'w') - for task_index in range(cpus): + for task_index in range(task_num): with open('task_index='+str(task_index)+'.txt', 'r') as f0: text = f0.read() f.write(text) diff --git a/2020.06.01_parallel_calculations_with_python/parallel_calculations_with_python.py b/2020.06.01_parallel_calculations_with_python/parallel_calculations_with_python.py index 15ee46b..60b03fe 100644 --- a/2020.06.01_parallel_calculations_with_python/parallel_calculations_with_python.py +++ b/2020.06.01_parallel_calculations_with_python/parallel_calculations_with_python.py @@ -1,3 +1,8 @@ +""" +This code is supported by the website: https://www.guanjihuan.com +The newest version of this code is on the web page: https://www.guanjihuan.com/archives/4536 +""" + from multiprocessing import Process import os import time diff --git a/2020.06.01_parallel_calculations_with_python/parallel_calculations_with_python_using_Value.py b/2020.06.01_parallel_calculations_with_python/parallel_calculations_with_python_using_Value.py index be08ebe..ee92b15 100644 --- a/2020.06.01_parallel_calculations_with_python/parallel_calculations_with_python_using_Value.py +++ b/2020.06.01_parallel_calculations_with_python/parallel_calculations_with_python_using_Value.py @@ -1,3 +1,8 @@ +""" +This code is supported by the website: https://www.guanjihuan.com +The newest version of this code is on the web page: https://www.guanjihuan.com/archives/4536 +""" + from multiprocessing import Process, Value def run_proc(name, a, num): # 要执行的代码 diff --git a/2024.01.16_GUAN_package_learning/example_of_array_division.py b/2024.01.16_GUAN_package_learning/example_of_array_division.py index 6c81c05..53515c6 100644 --- a/2024.01.16_GUAN_package_learning/example_of_array_division.py +++ b/2024.01.16_GUAN_package_learning/example_of_array_division.py @@ -1,9 +1,9 @@ # 数组分割示例 import numpy as np import guan -cpus = 4 +task_num = 4 parameter_array_all = np.arange(0, 17, 1) -for task_index in range(cpus): - parameter_array = guan.preprocess_for_parallel_calculations(parameter_array_all, cpus, task_index) +for task_index in range(task_num): + parameter_array = guan.preprocess_for_parallel_calculations(parameter_array_all, task_num, task_index) print(parameter_array) print() \ No newline at end of file diff --git a/2024.03.07_akshare_strategy/check_data.py b/2024.03.07_akshare_strategy/check_data.py index d717167..266f614 100644 --- a/2024.03.07_akshare_strategy/check_data.py +++ b/2024.03.07_akshare_strategy/check_data.py @@ -1,3 +1,8 @@ +""" +This code is supported by the website: https://www.guanjihuan.com +The newest version of this code is on the web page: https://www.guanjihuan.com/archives/38912 +""" + import guan stock_symbols_60, stock_symbols_00, stock_symbols_30, stock_symbols_68, \ diff --git a/2024.03.07_akshare_strategy/data_processing.py b/2024.03.07_akshare_strategy/data_processing.py index 08f2dea..dfe0e5a 100644 --- a/2024.03.07_akshare_strategy/data_processing.py +++ b/2024.03.07_akshare_strategy/data_processing.py @@ -1,3 +1,8 @@ +""" +This code is supported by the website: https://www.guanjihuan.com +The newest version of this code is on the web page: https://www.guanjihuan.com/archives/38912 +""" + import guan import numpy as np import datetime diff --git a/2024.03.07_akshare_strategy/download_data.py b/2024.03.07_akshare_strategy/download_data.py index 312604d..c671564 100644 --- a/2024.03.07_akshare_strategy/download_data.py +++ b/2024.03.07_akshare_strategy/download_data.py @@ -1,3 +1,8 @@ +""" +This code is supported by the website: https://www.guanjihuan.com +The newest version of this code is on the web page: https://www.guanjihuan.com/archives/38912 +""" + import guan stock_symbols_60, stock_symbols_00, stock_symbols_30, stock_symbols_68, \ stock_symbols_8_4,stock_symbols_others = guan.stock_symbols_classification() diff --git a/2024.03.07_akshare_strategy/strategy.py b/2024.03.07_akshare_strategy/strategy.py index 1e66e07..5b03a8b 100644 --- a/2024.03.07_akshare_strategy/strategy.py +++ b/2024.03.07_akshare_strategy/strategy.py @@ -1,3 +1,8 @@ +""" +This code is supported by the website: https://www.guanjihuan.com +The newest version of this code is on the web page: https://www.guanjihuan.com/archives/38912 +""" + import guan file_list_60 = guan.get_all_filenames_in_directory(directory='./2018_01_01_to_2024_03_07/stock_data_60', \ file_format=None, show_root_path=0, sort=1, include_subdirectory=1) diff --git a/2024.04.01_PCA_example/PCA_and_StandardScaler_example.py b/2024.04.01_PCA_example/PCA_and_StandardScaler_example.py index aaaf093..706d9f8 100644 --- a/2024.04.01_PCA_example/PCA_and_StandardScaler_example.py +++ b/2024.04.01_PCA_example/PCA_and_StandardScaler_example.py @@ -1,3 +1,8 @@ +""" +This code is supported by the website: https://www.guanjihuan.com +The newest version of this code is on the web page: https://www.guanjihuan.com/archives/39020 +""" + import numpy as np from sklearn.decomposition import PCA diff --git a/2024.04.01_PCA_example/PCA_example.py b/2024.04.01_PCA_example/PCA_example.py index bcc1c58..d440086 100644 --- a/2024.04.01_PCA_example/PCA_example.py +++ b/2024.04.01_PCA_example/PCA_example.py @@ -1,3 +1,8 @@ +""" +This code is supported by the website: https://www.guanjihuan.com +The newest version of this code is on the web page: https://www.guanjihuan.com/archives/39020 +""" + import numpy as np from sklearn.decomposition import PCA