Векторизація обчислень для оптимізації коду на мові програмування Python
Journal Title: Challenges and Issues of Modern Science - Year 2024, Vol 3, Issue 1
Abstract
Purpose. The purpose of this study is to explore vectorization as an engineering technique to improve the performance and readability of Python code, particularly in data processing tasks. We aim to demonstrate the benefits of vectorization through practical examples involving the handling of missing data. Design / Method / Approach. To achieve the research goals, we performed a comparative analysis between loop-based and vectorized implementations. Specifically, two versions of a function were developed to identify columns containing missing values within a dataset. These implementations were tested on two real-world datasets. We compared execution time and code readability. Findings. The findings showed that vectorization resulted in substantial performance improvements, reducing execution time by hundreds of times compared to traditional loop-based methods. Additionally, the vectorized code was more compact, leading to greater readability and ease of maintenance. Theoretical Implications. Vectorization provides a higher level of abstraction for performing operations on data structures. This allows developers to focus on algorithmic logic rather than managing iterative control structures, contributing to broader discussions on optimizing computational efficiency in Python. Practical Implications. For data engineers and analysts, vectorization represents a highly effective solution for optimizing Python code. It significantly accelerates data-intensive tasks, such as missing data imputation, data analysis, and machine learning, making it an essential tool for enhancing productivity in data-driven environments. Originality / Value. This study presents a practical approach to optimizing Python code through vectorization. It is valuable for professionals seeking to improve efficiency in their workflows. Research Limitations / Future Research. The limitation of this research lies in its focus on a single problem – missing data imputation. Future research should expand the scope to other computational areas, such as image processing and simulation modeling, or examine the use of vectorization alongside Just-In-Time (JIT) compilation using tools like Numba to further boost Python's performance. Paper Type. Practitioner Paper.
Authors and Affiliations
Олексій Земляний, Олег Байбуз
Інтегрування нестаціонарних систем оптимального керування із післядією та нестабільним спектром
Purpose. We considered a non-stationary optimal control system with delay. Non-stationary optimal control systems are described by systems of differential or differential-algebraic equations. Variable coefficients do not...
Internet of Things (IoT) technologies: features, development prospects and potential threats
Purpose. The article aims to explore the characteristics, development prospects, and possible threats associated with Internet of Things (IoT) technologies. With IoT rapidly integrating into multiple industries, understa...
Аналіз конструкцій та методика розрахунку мазутних пальників для опалювальних систем
Purpose. This article aims to show the principle and methodology of developing simple fuel oil burners for autonomous heating boilers that will provide room and water heating, making buildings independent of centralized...
Mathematical model for heat transfer in variable thickness fins for rocket engines
Purpose. This article aims to develop a mathematical model for a fin in the cooling system of liquid propellant rocket engines. The objective is to enable calculations for fins with arbitrary thickness variation. The dev...
Застосування комп’ютерно-інтегрованих технологій у проєктуванні ракетних двигунів
Purpose. The purpose of the study is to analyze the accumulated experience in designing rocket engines using computer-integrated technologies, and to identify current areas of development of this issue and tools for solv...