SERIES · Foundations of enterprise software
Python in public-sector data analysis: reproducibility, auditability and personal data
What analyses carried out with Python and open scientific libraries offer public institutions in terms of reproducibility, auditability and sharing without licence costs, and the personal data obligations involved.
- Python
- Data analysis
- KVKK
IN SHORT
- 01An analysis whose steps are recorded gives the same result when rerun with the same data, and becomes open to internal audit and review across units.
- 02Python, pandas, GeoPandas and Jupyter are distributed under free open-source licences; an analysis can be shared with other units without incurring a licence fee.
- 03Analyses involving personal data must be based on Law No. 6698 and the KVKK's guide to anonymisation, and the risk of anonymity being broken must be separately assessed.
Municipalities and public institutions base many decisions, from service planning to budget preparation, on data analysis. When calculations on population distribution, service demand, transport and infrastructure data are prepared through steps carried out manually in spreadsheet files, how the analysis was performed can no longer be traced afterwards, and verifying and reproducing the results becomes difficult.
This article examines, from a decision-maker's perspective, what analysis carried out with the Python programming language and the open-source scientific libraries around it offers public institutions, what licensing and support conditions it depends on, and what must be taken into account in studies involving personal data.
Open tools and licence conditions
Python is distributed under the Python Software Foundation License Version 2. This licence grants a non-exclusive, free, worldwide right to use, for reproducing, examining, testing, preparing derivative works from, and distributing Python. The condition is that the licence agreement and the copyright notice are preserved. Python's documentation states that all Python versions are open source.
The main libraries that accompany Python in data analysis are also distributed under free licences. Pandas, which enables work with tabular data, and GeoPandas, which adds geographic data support to pandas, are both licensed under BSD-3-Clause. Jupyter, which allows the explanatory text of analysis steps to be kept together with the results in a single document, is published under a licence the project describes as a modified BSD licence. Pandas has been among the projects supported by the non-profit organisation NumFOCUS since 2015, and GeoPandas since 2023; Jupyter is a non-profit project developed openly by community consensus.
The practical consequence of this licensing structure for institutions is that the analysis environment does not generate a cost tied to the number of users. An analysis prepared in one unit can be passed to another unit or another institution without requiring a licence-purchasing process, and opened and run there with the same tools.
Reproducible and auditable analysis
Reproducibility means that an analysis carried out with the same data and the same method gives the same result every time. When the steps of the analysis are kept as a written script or notebook document, rather than as manual copying, filtering and formula operations, the document itself shows which data was used, which records were excluded and on what grounds, and which calculation was performed. This matters in the public sector for two reasons.
The first is audit. When the figures behind a planning decision or a report are questioned, the analysis can be rerun from the beginning to show whether the same result is reached. The second is continuity. When the staff member who prepared the analysis changes role, the work does not remain dependent on that person's memory; the same report can be reproduced the next period with current data, following the same steps.
“An analysis whose steps are documented in writing can be rerun, scrutinised and updated independently of the person who prepared it.”
To ensure reproducibility, the dated version of the data used, as well as the versions of Python and the libraries used, must also be recorded alongside the analysis document. Because the same steps can give a different result when library versions change, version information must be kept as an inseparable part of the analysis.
Support period of Python versions
According to the Python Developer's Guide, a Python version receives bug and security fixes after release. After two years (18 months for versions before 3.13), only security fixes are accepted, and support ends five years after release. According to the schedule in the guide, as of 23 October 2026 the situation is as follows:
- Python 3.15: released on 9 October 2026, currently in the bugfix phase; support is planned to end in October 2031.
- Python 3.14: in the bugfix phase; support is planned to end in October 2030.
- Python 3.13, 3.12 and 3.11: receive security fixes only; support is planned to end in October 2029, October 2028 and October 2027 respectively.
- Python 3.10: support ended on 1 October 2026.
The version of Python used in an institution's analysis environments should, like other software components, be tracked in the inventory and updated before its support period expires. For analyses intended to be used over a long period, starting with a version still in the bugfix phase helps defer the need to upgrade.
Personal data and anonymisation
A significant part of public-sector data contains personal data. Law No. 6698 on the Protection of Personal Data defines anonymisation as rendering personal data impossible to associate with an identified or identifiable natural person under any circumstances, even when matched with other data. Under Article 7 of the Law, personal data whose grounds for processing have ceased must be deleted, destroyed or anonymised. Article 28, first paragraph, subparagraph (b), excludes from the scope of the Law the processing of personal data for purposes such as research, planning and statistics through official statistics and anonymisation.
The Personal Data Protection Authority's Guide on the Deletion, Destruction or Anonymisation of Personal Data, dated April 2025, explains anonymisation methods with examples. The guide covers methods such as removing variables and records, regional suppression, generalisation and sampling, as well as statistical methods that strengthen anonymity, such as k-anonymity, l-diversity and t-closeness.
The risk of anonymity being broken
The KVKK's guide draws attention to the fact that anonymised data can become identifying again through various interventions. What matters is that measures have been taken to prevent new users who access the data after it is shared or disclosed from breaking its anonymity.
Reproducible analysis also provides convenience to the institution on this point. When the anonymisation steps are written into the analysis document, it is possible to audit which fields were removed, which values were generalised, and which thresholds were used. The authority under which personal data was transferred into the analysis environment, and how it will be stored after the analysis, must comply with the institution's personal data retention and destruction policy.
Open data and sharing across units
The output of an analysis prepared with open tools and properly anonymised is suitable for sharing with other units within the institution or with the public as open data. Providing the analysis steps alongside the result table when sharing guides users and researchers who wish to see how the data was produced. To this end, it is advisable for the institution to archive its analysis documents, the tool versions used and the anonymisation steps in a consistent format, to set a common practice across units, and to ensure that raw data containing personal data is kept separate from the shared version.
Establishing this practice within an institution is helped by setting the following minimum rules:
- Every analysis underlying a decision or a report is archived with its steps as a written script or notebook document.
- The source and date of the data used in the analysis, together with the Python and library versions, are kept together with the analysis document.
- In analyses involving personal data, the anonymisation steps are shown explicitly in the document and reviewed by a second person before sharing.
- The Python versions used in analysis environments are tracked in the software inventory and updated before their support period expires.
Sources
- History and License (Python Software Foundation)
- Status of Python versions (Python Developer's Guide)
- pandas License, BSD 3-Clause (pandas-dev)
- About pandas (pandas)
- About GeoPandas (GeoPandas)
- About Project Jupyter (Project Jupyter)
- Law No. 6698 on the Protection of Personal Data (Mevzuat Bilgi Sistemi)
- Guide on the Deletion, Destruction or Anonymisation of Personal Data (KVKK, April 2025)
This article has been prepared for general information purposes only and does not constitute legal, financial, technical or other professional advice. Legislative and technical information reflects the position as at the date of publication. Short extracts may be quoted provided that the source is cited and a link to the article is given; publication of the article in full or of a substantial part of it is subject to written permission. Terms of use
