Data Wrangling and Visualization

Chapter 14
Ethics, Privacy and Data Governance

Diploma in Data science
Data Wrangling and Visualization   •   Diploma

Ethics, Privacy and Data Governance

Introduction

Data wrangling and visualization are often presented as technical activities: collecting records, correcting errors, joining tables, calculating indicators and communicating patterns. In practice, however, every stage involves judgments about people, organizations and public interests. A decision about which records to exclude can change an apparent trend. A dashboard can reveal a person’s identity even when names have been removed. A chart can imply causation where only association has been observed. A model can reproduce historical discrimination while appearing objective because it uses numerical data.

Ethics, privacy and governance provide the principles and controls needed to prevent such harms. Ethics concerns what ought to be done, including fairness, respect, accountability and avoidance of harm. Privacy concerns appropriate control over information about identifiable or identifiable individuals. Security concerns protection against unauthorized access, alteration, loss or disclosure. Governance establishes roles, rules, processes and evidence so that data is managed consistently throughout its life cycle.

For a data scientist, responsible practice is not an additional step after analysis. It begins when a purpose is defined and continues through collection, consent, storage, wrangling, analysis, visualization, sharing, retention and deletion. This chapter develops a practical framework for applying these ideas in professional data work.

Learning Objectives

By the end of this chapter, you should be able to:

  • distinguish ethics, privacy, confidentiality, security and governance;
  • apply purpose limitation, data minimization, consent and lawful-use principles;
  • identify direct and indirect identifiers and explain re-identification risk;
  • use ownership, provenance, retention and access controls responsibly;
  • recognize bias introduced by collection, wrangling, analysis and visualization;
  • design accessible and honest visualizations;
  • explain the practical significance of regulatory and organizational requirements;
  • apply a governance framework to a realistic data-wrangling project.

1. The Data Life Cycle and Responsibility

A useful governance perspective treats data as moving through a life cycle:

  1. Planning: define the question, purpose, affected people and risks.
  2. Collection: obtain data lawfully, fairly and with appropriate notice.
  3. Storage: protect data through access controls, encryption and secure infrastructure.
  4. Preparation: clean, transform, join and document data without concealing important limitations.
  5. Analysis: select methods appropriate to the data and investigate bias and uncertainty.
  6. Communication: present results accurately, accessibly and at an appropriate level of detail.
  7. Sharing and use: ensure recipients have a legitimate purpose and understand restrictions.
  8. Retention or disposal: keep data only as long as justified, then securely delete or anonymize it.

Responsibility is distributed across this life cycle. A data engineer may control pipelines, an analyst may choose transformations, a manager may approve the purpose, a privacy officer may assess risks, and a visualization designer may determine what an audience sees. Shared responsibility does not mean that accountability disappears. Each participant should know their role, authority and escalation route.

2. Core Ethical Principles

Several principles recur in professional codes, public-sector guidance and privacy regulation.

Respect for persons and autonomy

People should not be treated merely as data points. They should receive understandable information about significant uses of their data and, where required, be able to agree, refuse, withdraw or exercise other rights. Consent is meaningful only when it is informed, specific, freely given and not obtained through deception or coercion.

Beneficence and non-maleficence

A project should aim to produce legitimate benefit and reduce foreseeable harm. Harm may be financial, physical, psychological, reputational, social or discriminatory. A technically accurate model can still be unethical if its deployment causes avoidable harm.

Fairness and non-discrimination

Data processes should not unfairly disadvantage people because of protected characteristics or their proxies. Fairness is context-dependent: equal treatment, equal opportunity, equal outcomes and needs-based treatment are not identical goals. A project should state which conception is relevant rather than claiming that a single metric proves fairness.

Transparency and explainability

People affected by an important decision should receive an understandable explanation of the data used, the purpose, the principal factors and the available challenge or appeal process. Transparency does not require publishing confidential source code or every internal detail, but it does require honest disclosure of material limitations.

Accountability

An organization should be able to demonstrate how a decision was made, who approved it, what evidence was considered and how problems are corrected. Documentation, audit logs, version control and impact assessments support accountability.

Proportionality

The intrusiveness of collection and analysis should be proportionate to the legitimate purpose. A minor service improvement rarely justifies indefinite storage of highly sensitive personal data.

3. Privacy, Confidentiality and Security

These terms are related but distinct. Privacy concerns appropriate collection, use and disclosure of information. Confidentiality is the duty to restrict information to authorized recipients. Security consists of technical and organizational measures that protect confidentiality, integrity and availability. A dataset may be securely stored but collected for an unjustified purpose; security alone does not make the processing ethical.

Personal and sensitive data

Personal data is information relating to an identified or identifiable person. Names, identification numbers, email addresses and photographs are direct identifiers. Dates of birth, postal areas, device identifiers, account numbers and precise timestamps can become identifying when combined. Health, biometric, genetic, financial, political, religious and some employment information is commonly treated as sensitive or special-category data, although legal definitions vary by jurisdiction.

A useful classification is:

CategoryExampleTypical control
PublicPublished annual totalsIntegrity and source checking
InternalOperational performance tableRole-based access
ConfidentialCustomer transaction recordsRestricted access and encryption
Highly sensitiveMedical or biometric recordsStrong legal basis, minimized access, enhanced monitoring

Classification should be based on potential harm and legal obligations, not merely on where a file is stored.

De-identification and re-identification

Removing names does not necessarily make data anonymous. A person may be re-identified through quasi-identifiers such as age, location and date. Pseudonymization replaces identifiers with codes while retaining a key; it reduces exposure but remains personal data if re-linking is possible. Anonymization aims to make identification reasonably impossible using available means, but the risk must be assessed in context and over time.

Aggregation, generalization, suppression and perturbation can reduce risk. For example, reporting counts by broad region rather than exact address may be appropriate. However, small-cell disclosure can reveal an individual, and repeated releases can allow differencing attacks. Analysts should avoid publishing a statistic for a very small group unless there is a compelling justification and suitable protection.

Security controls

Important controls include:

  • least-privilege, role-based access;
  • multi-factor authentication;
  • encryption in transit and at rest;
  • secure secrets and key management;
  • separation of development, testing and production data;
  • logging and monitoring of access;
  • backups and recovery testing;
  • patching, vulnerability management and incident response;
  • secure deletion of files, extracts and temporary copies.

A common failure is to protect a production database while leaving unencrypted exports in notebooks, email attachments or personal cloud storage.

4. Consent, Lawful Use and Data Subject Rights

The legal basis for processing differs by jurisdiction and context. Common bases include consent, contractual necessity, legal obligation, protection of vital interests, public task and legitimate interests subject to balancing tests. Consent should not be used as a substitute for careful purpose definition. If a service is conditional on unnecessary data collection, consent may not be genuinely freely given.

Good notices explain who is collecting the data, why it is needed, what categories are involved, how long it will be kept, with whom it may be shared and how a person can exercise applicable rights. Depending on the jurisdiction, individuals may have rights to access, correction, deletion, restriction, portability, objection and review of certain automated decisions.

Secondary use requires special care. Data collected to provide a clinic appointment should not automatically be used to train a commercial advertising model. A new use may require fresh notice, consent, compatibility assessment, ethics review or a new legal basis. Public availability is not the same as unrestricted ethical use: web-scraped information may still contain personal data, contractual restrictions or contextual expectations of privacy.

Regulatory frameworks vary. Examples include the European Union’s General Data Protection Regulation, the California Consumer Privacy Act and sector-specific rules such as health or education privacy laws. These instruments should not be treated as interchangeable. Organizations must identify the jurisdiction, controller or processor responsibilities, cross-border-transfer rules, breach obligations and sector requirements that apply. Legal advice is appropriate when consequences are significant.

5. Ownership, Stewardship and Provenance

Data ownership is often more complex than possession of a file. A customer may have rights concerning information about them; an employer may control operational records; a research participant may have consent-related interests; a public body may hold data under statutory duties; and a vendor may license access without transferring ownership. Contracts, intellectual-property law, privacy law and organizational policy may all apply.

Data stewardship is the responsible management of data on behalf of its subjects, users and organization. A steward maintains definitions, quality rules, access decisions and documentation. Governance commonly assigns:

  • Data owner: accountable for business purpose and access decisions.
  • Data steward: manages quality, definitions, metadata and operational rules.
  • Data custodian: operates storage, platforms and security controls.
  • Data protection or privacy officer: advises on privacy obligations and risk.
  • Analyst or scientist: uses data within approved purposes and documents methods.

Provenance records where data came from, how it was transformed and which output depends on it. A provenance record may include source system, collection date, license, schema, cleaning operations, joins, filters, software version and responsible person. Without provenance, an attractive dashboard may be impossible to reproduce or audit.

A practical transformation log might state: “Source S, extracted 12 March; duplicate customer rows removed using transaction ID; missing age retained as unknown; currency converted using the approved monthly rate; records outside the approved date range excluded.” This is more valuable than a vague statement that the data was “cleaned.”

6. Retention, Deletion and Data Quality

Retention should be tied to purpose, legal requirements, operational need and risk. “Keep everything indefinitely” is not a neutral policy: it increases exposure, storage cost and the consequences of a breach. A retention schedule should specify the record type, responsible owner, retention period or review trigger, archival conditions and secure disposal method.

Deletion must include copies in databases, backups, extracts, caches, notebooks and collaboration platforms where feasible. If immediate deletion from immutable backups is impossible, access should be restricted and the data removed during the next controlled cycle.

Data quality is an ethical issue because inaccurate data can harm people. Important dimensions include accuracy, completeness, consistency, timeliness, validity, uniqueness and fitness for purpose. Missing values should not automatically be replaced with zero, and an outlier should not be removed merely because it weakens a desired conclusion. Every transformation should preserve meaning or clearly record the change.

7. Bias and Fairness in the Data Pipeline

Bias is a systematic distortion that produces unfair or misleading results. It can enter at multiple points:

  • Coverage bias: some groups are absent or underrepresented.
  • Sampling bias: the sample differs systematically from the target population.
  • Measurement bias: a variable is measured less accurately for one group.
  • Historical bias: past decisions reflect unequal opportunities or discrimination.
  • Label bias: an outcome label reflects institutional practice rather than the underlying construct.
  • Aggregation bias: one model or summary is applied to groups with different patterns.
  • Deployment bias: a system is used in a context different from the one for which it was designed.

For example, an employee survey may show higher satisfaction among respondents, but employees experiencing the greatest dissatisfaction may be least likely to respond. Weighting can sometimes improve representativeness, but it does not repair missing groups or invalid measurement automatically.

Bias assessment should compare data coverage, missingness, error rates and outcomes across relevant groups. Analysts should consider intersectional groups, while protecting individuals from unnecessary disclosure. Fairness metrics may conflict: equal false-positive rates, equal false-negative rates, calibration and equal selection rates cannot always be achieved simultaneously when base rates differ. Therefore, metric selection must follow the decision context and ethical objective.

Do not infer sensitive attributes casually. Use them only where there is a legitimate, protected evaluation purpose and appropriate safeguards. “Bias-free” is not a credible claim; responsible work describes tested risks, limitations and mitigation actions.

8. Responsible Visualization

Visualization is an argument made with visual encoding. Ethical visualization requires accurate scales, honest labels, suitable aggregation and disclosure of uncertainty.

Common problems include truncated axes that exaggerate differences, three-dimensional effects that distort magnitude, inconsistent colors, hidden denominators, selective time periods, inappropriate choropleth maps and displaying averages without distributional information. A chart should make the comparison the data supports, not the conclusion the author wishes to suggest.

Use zero baselines for bar charts when bar length represents magnitude, unless a clearly signposted alternative is justified. For rates, display the denominator and population definition. Distinguish counts from percentages and state whether percentages use all records or only valid responses. Report missing data and avoid implying that correlation establishes causation.

Uncertainty can be communicated through confidence intervals, error bars, ranges, scenario bands or explanatory text. A confidence interval describes uncertainty under a specified statistical procedure and sampling model; it is not automatically the probability that a fixed parameter lies in the interval. If the audience cannot interpret an interval, provide a plain-language explanation without removing important uncertainty.

Accessibility is part of ethical communication. Use sufficient color contrast, direct labels, patterns or symbols in addition to color, readable text, logical tab order and alternative text. Avoid red-versus-green distinctions that exclude many color-vision-deficient users. Provide a table or textual summary for complex graphics. Accessibility also includes language, literacy, device constraints and cultural context.

9. Governance Framework for Practical Projects

A workable project governance process can be organized as follows:

Stage 1: Define the use case

Write the purpose, expected benefit, affected populations, decisions supported and unacceptable uses. Ask whether the project needs personal data at all.

Stage 2: Conduct a risk and impact assessment

Identify sensitive attributes, vulnerable groups, possible harms, data flows, third parties, cross-border transfers and worst-case outcomes. A data protection impact assessment may be legally required for high-risk processing.

Stage 3: Establish controls

Select the lawful basis, consent and notice approach, retention period, access roles, security measures, quality tests and escalation process. Prefer aggregated or synthetic data for development where suitable.

Stage 4: Build traceable pipelines

Version code and schemas, record provenance, validate inputs, test transformations and separate raw, processed and published layers. Never overwrite the raw source without preserving an approved immutable copy and its access controls.

Stage 5: Review results before release

Check statistical validity, subgroup performance, disclosure risk, visual accessibility, audience interpretation and whether the output exceeds the approved purpose. Independent review is valuable for high-impact applications.

Stage 6: Monitor and improve

After deployment, monitor drift, complaints, access logs, incidents, subgroup outcomes and changes in law or context. Governance is continuous rather than a one-time approval.

10. Illustrative Case: Public Transport Demand Dashboard

Background

A city transport authority plans a dashboard to improve bus scheduling. It has smart-card transactions, vehicle GPS records, customer complaints and census-based neighborhood statistics. The proposed dashboard would show demand by stop, time and neighborhood.

Problem

Raw transactions contain card identifiers and precise timestamps. Small neighborhoods may reveal travel patterns of individuals. Complaint data includes free-text descriptions and contact details. The authority wants to publish a public map and provide more detailed data to an external planning contractor.

Analysis

The purpose is service planning, not individual surveillance. Card identifiers are unnecessary after calculating approved aggregate measures. Exact timestamps and stops create a re-identification risk when combined with public events or known routines. Complaint text requires removal of contact details and review for names and unusual personal circumstances. Neighborhood-level results may be unstable where passenger counts are low.

The team also discovers that smart-card use is lower among cash-paying passengers and among some groups with limited access to banking services. A dashboard based only on card data could therefore allocate resources unfairly. GPS records measure vehicle movement, not passenger demand, and should not be treated as an equivalent measure.

Approach and solution

The authority documents the purpose and lawful basis, limits access through roles and contracts, and publishes only aggregated counts and rates. It removes card identifiers after a controlled aggregation step, generalizes time into intervals, suppresses or combines cells below a risk threshold, and applies a retention schedule. The team reports coverage limitations and compares card-based demand with surveys and manual counts.

The public visualization uses an accessible color palette, direct labels, a downloadable table and an explanation of denominators and missing coverage. The contractor receives a minimized dataset under a data-processing agreement, with use restrictions, deletion requirements and audit rights. An independent review tests disclosure risk and subgroup service effects before release.

Outcome

The dashboard supports schedule changes while reducing the chance of tracking individuals. The authority also identifies areas where card data underrepresents demand and commissions additional counts rather than treating the original data as complete.

Learning points

The case demonstrates that privacy is shaped by combinations of fields, not only by obvious identifiers. It also shows that governance, data quality, fairness and visualization are connected: a technically elegant dashboard can produce inequitable decisions if its coverage is misunderstood.

11. Technology, Automation and AI

Automated tools can strengthen governance through data catalogs, lineage systems, access monitoring, privacy-preserving transformations and automated quality tests. They can also create new risks. Generative AI tools may retain prompts, expose confidential records or produce plausible but false explanations. Analysts should not upload restricted data to an unapproved service, and AI-generated code or summaries must be reviewed, tested and documented.

Privacy-enhancing technologies include tokenization, secure multiparty computation, differential privacy and federated learning. These methods have different assumptions and utility costs. Differential privacy, for example, adds controlled randomness so that the contribution of one individual has limited influence on an output; its protection depends on the mechanism, privacy parameters, composition across releases and threat model. It is not a guarantee that every release is harmless.

Automated decision systems require human oversight proportionate to impact. A human reviewer should have sufficient authority, information and time to challenge an output, rather than simply approving it automatically. Models should be monitored after deployment because populations, behaviors and institutional practices change.

12. Challenges and Limitations

No governance framework eliminates risk. Anonymization is vulnerable to changing external datasets; consent may be difficult to interpret in complex data ecosystems; fairness definitions can conflict; security controls can reduce convenience; strict minimization can limit useful longitudinal research; and excessive documentation can become a compliance ritual rather than meaningful accountability.

There are also power imbalances. People may technically receive a privacy notice but lack realistic alternatives. Communities may distrust institutions because of historical misuse. Public-interest data sharing can generate substantial benefits, yet affected communities should have a voice in defining acceptable uses. Good practice therefore combines legal compliance with contextual judgment, consultation, proportionality and continuous review.

Best-Practice Checklist

Before releasing a dataset, analysis or visualization, ask:

  • Is the purpose specific, legitimate and documented?
  • Is every collected field necessary?
  • What lawful basis, consent process or authorization applies?
  • Could individuals be identified from combinations of fields?
  • Are access, encryption, logging and incident procedures in place?
  • Is provenance sufficient to reproduce the result?
  • Are missingness, measurement limits and subgroup coverage understood?
  • Could the output disadvantage a group or expose a vulnerable person?
  • Are scales, denominators, uncertainty and causality represented honestly?
  • Is the output accessible to people with different abilities and devices?
  • Is the retention and deletion decision explicit?
  • Who is accountable for approval, correction and complaints?

Chapter Summary

Ethical data wrangling and visualization require more than accurate code. Privacy concerns appropriate control over personal information; confidentiality restricts disclosure; security protects confidentiality, integrity and availability; and governance assigns responsibilities and creates evidence of responsible practice. Purpose limitation, data minimization, meaningful consent, proportionality, fairness, transparency and accountability are central principles.

Personal data can remain identifiable through combinations of quasi-identifiers, and pseudonymization is not the same as anonymization. Ownership, stewardship and provenance clarify who may use data, under what authority, and how transformations can be audited. Retention should be justified, and deletion should include uncontrolled copies where feasible. Bias can enter through sampling, measurement, historical labels, aggregation and deployment. Responsible visualizations disclose denominators, limitations and uncertainty while avoiding misleading scales and inaccessible design.

A professional governance process defines the purpose, assesses impact, establishes controls, builds traceable pipelines, reviews outputs and monitors use after deployment. Regulation provides important obligations, but ethical responsibility extends beyond minimum legal compliance. The goal is data work that is useful, explainable, secure, fair and respectful of the people and communities represented.

Key Terms

Accountability: The duty to explain decisions, accept responsibility and provide remedies.

Anonymization: Processing intended to make identification of individuals reasonably impossible using available means.

Bias: Systematic distortion that produces unfair or misleading results.

Confidentiality: Restriction of information to authorized people or systems.

Consent: An informed and voluntary agreement to a specified use of data.

Data governance: Roles, rules, processes and controls for managing data.

Data minimization: Collecting and using no more data than a legitimate purpose requires.

Data provenance: A record of data origins, transformations, dependencies and custodians.

Data steward: A person responsible for data definitions, quality, metadata and operational management.

De-identification: Techniques that reduce the association between data and identifiable individuals.

Fairness: The ethically appropriate treatment of individuals or groups in a particular context.

Lawful basis: The recognized legal justification for processing personal data.

Personal data: Information relating to an identified or identifiable person.

Pseudonymization: Replacing identifiers with codes while retaining a possible re-linking mechanism.

Purpose limitation: Using data only for specified, legitimate and compatible purposes.

Quasi-identifier: A field that may identify someone when combined with other information.

Retention schedule: A rule specifying how long data is kept and when it is reviewed or destroyed.

Security: Technical and organizational protection of data confidentiality, integrity and availability.

Transparency: Clear communication about data practices, methods, decisions and limitations.

Review Questions

5 Short Answer Questions

  1. Distinguish privacy, confidentiality and security.
  2. Why does removing a person’s name not necessarily anonymize a dataset?
  3. What is the purpose of a data provenance record?
  4. Give two examples of bias that can enter before model deployment.
  5. State two accessibility practices for data visualizations.

5 Long Answer Questions

  1. Explain how purpose limitation and data minimization should influence the design of a data-wrangling project.
  2. Compare pseudonymization and anonymization, including the risks associated with each.
  3. Discuss the roles of a data owner, data steward, data custodian and privacy officer.
  4. Explain why fairness metrics may conflict and how a team should choose an appropriate fairness objective.
  5. Describe a complete governance life cycle from project planning through retention or disposal.

3 Analytical / Application Questions

  1. A university wants to publish student achievement by small demographic groups. Analyze the privacy, fairness, statistical and visualization risks, then propose controls.
  2. A retailer uses historical purchasing data to prioritize customers for credit offers. Identify possible sources of bias and design an assessment and mitigation plan.
  3. Review a dashboard that uses a truncated bar-chart axis, omits its denominator and displays precise neighborhood counts. Explain how it could mislead users and redesign its communication approach.

Multiple Choice Questions with Answers

Question 1

Which statement best distinguishes pseudonymization from anonymization?

A. Pseudonymization permanently destroys all identifying information.

B. Pseudonymization replaces identifiers but may permit re-linking through a retained key.

C. Anonymization always requires encrypting the original database.

D. Anonymization means that access controls are no longer necessary.

Correct Answer: B. Pseudonymization replaces identifiers but may permit re-linking through a retained key.

Question 2

Which principle means that an organization should collect no more personal data than its stated purpose requires?

A. Data minimization

B. Data portability

C. Purpose expansion

D. Unrestricted retention

Correct Answer: A. Data minimization

Question 3

A dashboard reports the number of complaints but does not state the number of customers or transactions. Which interpretation problem is most direct?

A. Lack of provenance

B. Missing denominator context

C. Excessive encryption

D. Role duplication

Correct Answer: B. Missing denominator context

Question 4

Which role is primarily responsible for maintaining data definitions, metadata and operational quality rules?

A. Data steward

B. External auditor only

C. Dashboard viewer

D. End customer

Correct Answer: A. Data steward

Question 5

Why can a dataset containing no names still create re-identification risk?

A. Charts automatically add names.

B. Quasi-identifiers can be combined with other available information.

C. Encryption converts values into identities.

D. Aggregated data is always more precise than raw data.

Correct Answer: B. Quasi-identifiers can be combined with other available information.

Question 6

Which practice most directly improves accessibility of a chart for people who cannot distinguish some colors?

A. Use red and green as the only category distinction.

B. Remove all labels and rely on a legend.

C. Use direct labels or patterns in addition to color.

D. Use three-dimensional effects.

Correct Answer: C. Use direct labels or patterns in addition to color.

Question 7

Which is an example of historical bias?

A. A file is stored using encryption.

B. A past promotion process favored one group, and a model learns that pattern.

C. A chart uses a readable font.

D. A database contains a primary key.

Correct Answer: B. A past promotion process favored one group, and a model learns that pattern.

Question 8

What is the main purpose of a retention schedule?

A. To justify keeping every record permanently

B. To specify how long data is kept and when it is reviewed or disposed of

C. To replace authentication controls

D. To guarantee that data is accurate

Correct Answer: B. To specify how long data is kept and when it is reviewed or disposed of

Question 9

Which statement about public availability is most accurate?

A. Publicly accessible data is automatically free of privacy obligations.

B. Public data can never be used for research.

C. Public availability does not automatically remove privacy, contractual or contextual responsibilities.

D. Public data must always be published again in raw form.

Correct Answer: C. Public availability does not automatically remove privacy, contractual or contextual responsibilities.

Question 10

Which action best supports reproducible and accountable data wrangling?

A. Overwrite the raw data after cleaning.

B. Record sources, transformations, software versions and responsible personnel.

C. Remove all documentation after publication.

D. Allow every user unrestricted database access.

Correct Answer: B. Record sources, transformations, software versions and responsible personnel.

Data Wrangling and Visualization
Chapter 14 of 15