A Large-Scale Comparison of Python Code in Jupyter Notebooks and Scripts

03/30/2022
by   Konstantin Grotov, et al.
0

In recent years, Jupyter notebooks have grown in popularity in several domains of software engineering, such as data science, machine learning, and computer science education. Their popularity has to do with their rich features for presenting and visualizing data, however, recent studies show that notebooks also share a lot of drawbacks: high number of code clones, low reproducibility, etc. In this work, we carry out a comparison between Python code written in Jupyter Notebooks and in traditional Python scripts. We compare the code from two perspectives: structural and stylistic. In the first part of the analysis, we report the difference in the number of lines, the usage of functions, as well as various complexity metrics. In the second part, we show the difference in the number of stylistic issues and provide an extensive overview of the 15 most frequent stylistic issues in the studied mediums. Overall, we demonstrate that notebooks are characterized by the lower code complexity, however, their code could be perceived as more entangled than in the scripts. As for the style, notebooks tend to have 1.4 times more stylistic issues, but at the same time, some of them are caused by specific coding practices in notebooks and should be considered as false positives. With this research, we want to pave the way to studying specific problems of notebooks that should be addressed by the development of notebook-specific tools, and provide various insights that can be useful in this regard.

READ FULL TEXT
research
07/17/2020

A large-scale comparative analysis of Coding Standard conformance in Open-Source Data Science projects

Background: Meeting the growing industry demand for Data Science require...
research
07/01/2016

Want Drugs? Use Python

We describe how Python can be leveraged to streamline the curation, mode...
research
08/10/2021

PyNose: A Test Smell Detector For Python

Similarly to production code, code smells also occur in test code, where...
research
05/03/2022

A Survey of Deep Learning Models for Structural Code Understanding

In recent years, the rise of deep learning and automation requirements i...
research
11/11/2021

Developing and Publishing Code for Trusted Research Environments: Best Practices and Ways of Working

This report discusses 3 distinct, but overlapping topics. Firstly, it re...
research
02/26/2022

Python for Smarter Cities: Comparison of Python libraries for static and interactive visualisations of large vector data

Local governments, as part of 'smart city' initiatives and to promote in...
research
05/19/2023

An Approach to Multiple Comparison Benchmark Evaluations that is Stable Under Manipulation of the Comparate Set

The measurement of progress using benchmarks evaluations is ubiquitous i...

Please sign up or login with your details

Forgot password? Click here to reset