Dataset Preview
Duplicate
The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
The dataset generation failed because of a cast error
Error code:   DatasetGenerationCastError
Exception:    DatasetGenerationCastError
Message:      An error occurred while generating the dataset

All the data files must have the same columns, but at some point there are 5 new columns ({'nullable', 'description', 'type', 'constraints', 'name'}) and 5 missing columns ({'year', 'indicator_code', 'value', 'indicator_name', 'unit'}).

This happened while the csv dataset builder was generating data using

hf://datasets/opendoc-pakistan/pakistan_macroeconomic_indicators/data_dictionary.csv (at revision 5f8006eb3d1118e63343fdcf2cc322fd540715e0), ['hf://datasets/opendoc-pakistan/pakistan_macroeconomic_indicators@5f8006eb3d1118e63343fdcf2cc322fd540715e0/data/processed/macroeconomic_indicators.csv', 'hf://datasets/opendoc-pakistan/pakistan_macroeconomic_indicators@5f8006eb3d1118e63343fdcf2cc322fd540715e0/data_dictionary.csv']

Please either edit the data files to have matching columns, or separate them into different configurations (see docs at https://hf.co/docs/hub/datasets-manual-configuration#multiple-configurations)
Traceback:    Traceback (most recent call last):
                File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1837, in _prepare_split_single
                  writer.write_table(table)
                  ~~~~~~~~~~~~~~~~~~^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/arrow_writer.py", line 765, in write_table
                  self._write_table(pa_table, writer_batch_size=writer_batch_size)
                  ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/arrow_writer.py", line 773, in _write_table
                  pa_table = table_cast(pa_table, self._schema)
                File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2369, in table_cast
                  return cast_table_to_schema(table, schema)
                File "/usr/local/lib/python3.14/site-packages/datasets/table.py", line 2297, in cast_table_to_schema
                  raise CastError(
                  ...<3 lines>...
                  )
              datasets.table.CastError: Couldn't cast
              name: string
              type: string
              description: string
              nullable: bool
              constraints: string
              -- schema metadata --
              pandas: '{"index_columns": [{"kind": "range", "name": null, "start": 0, "' + 848
              to
              {'indicator_code': Value('string'), 'indicator_name': Value('string'), 'year': Value('int64'), 'value': Value('float64'), 'unit': Value('string')}
              because column names don't match
              
              During handling of the above exception, another exception occurred:
              
              Traceback (most recent call last):
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1369, in compute_config_parquet_and_info_response
                  parquet_operations, partial, estimated_dataset_info = stream_convert_to_parquet(
                                                                        ~~~~~~~~~~~~~~~~~~~~~~~~~^
                      builder, max_dataset_size_bytes=max_dataset_size_bytes
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                  )
                  ^
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 948, in stream_convert_to_parquet
                  builder._prepare_split(split_generator=splits_generators[split], file_format="parquet")
                  ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1683, in _prepare_split
                  for job_id, done, content in self._prepare_split_single(
                                               ~~~~~~~~~~~~~~~~~~~~~~~~~~^
                      gen_kwargs=gen_kwargs, job_id=job_id, **_prepare_split_args
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                  ):
                  ^
                File "/usr/local/lib/python3.14/site-packages/datasets/builder.py", line 1839, in _prepare_split_single
                  raise DatasetGenerationCastError.from_cast_error(
                  ...<4 lines>...
                  )
              datasets.exceptions.DatasetGenerationCastError: An error occurred while generating the dataset
              
              All the data files must have the same columns, but at some point there are 5 new columns ({'nullable', 'description', 'type', 'constraints', 'name'}) and 5 missing columns ({'year', 'indicator_code', 'value', 'indicator_name', 'unit'}).
              
              This happened while the csv dataset builder was generating data using
              
              hf://datasets/opendoc-pakistan/pakistan_macroeconomic_indicators/data_dictionary.csv (at revision 5f8006eb3d1118e63343fdcf2cc322fd540715e0), ['hf://datasets/opendoc-pakistan/pakistan_macroeconomic_indicators@5f8006eb3d1118e63343fdcf2cc322fd540715e0/data/processed/macroeconomic_indicators.csv', 'hf://datasets/opendoc-pakistan/pakistan_macroeconomic_indicators@5f8006eb3d1118e63343fdcf2cc322fd540715e0/data_dictionary.csv']
              
              Please either edit the data files to have matching columns, or separate them into different configurations (see docs at https://hf.co/docs/hub/datasets-manual-configuration#multiple-configurations)

Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.

indicator_code
string
indicator_name
string
year
int64
value
float64
unit
string
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
1,970
23,000,000
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
1,971
1,000,000
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
1,972
17,000,000
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
1,973
-4,000,000
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
1,974
4,000,000
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
1,975
25,000,000
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
1,976
8,220,530.167889
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
1,977
15,223,204.01461
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
1,978
32,273,192.510972
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
1,979
58,254,127.362573
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
1,980
63,632,992.781068
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
1,981
108,084,748.503728
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
1,982
63,833,091.624158
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
1,983
29,457,026.664816
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
1,984
55,510,169.711646
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
1,985
131,389,252.246715
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
1,986
105,730,331.820871
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
1,987
129,377,643.59248
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
1,988
186,491,557.33337
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
1,989
210,599,917.11983
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
1,990
245,262,963.460759
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
1,991
258,414,487.035347
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
1,992
336,479,857.130617
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
1,993
348,556,957.814185
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
1,994
421,024,638.454287
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
1,995
722,631,560.660743
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
1,996
921,976,182.51983
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
1,997
716,253,125.440908
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
1,998
506,000,000
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
1,999
532,000,000
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
2,000
308,000,000
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
2,001
378,000,000
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
2,002
826,000,000
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
2,003
534,000,000
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
2,004
1,118,000,000
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
2,005
2,201,000,000
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
2,006
4,273,000,000
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
2,007
5,590,000,000
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
2,008
5,438,000,000
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
2,009
2,338,000,000
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
2,010
2,022,000,000
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
2,011
1,326,000,000
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
2,012
859,000,000
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
2,013
1,333,000,000
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
2,014
1,887,000,000
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
2,015
1,673,000,000
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
2,016
2,576,000,000
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
2,017
2,496,000,000
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
2,018
1,737,000,000
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
2,019
2,234,000,000
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
2,020
2,057,000,000
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
2,021
2,147,000,000
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
2,022
1,462,000,000
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
2,023
2,048,000,000
current_usd
BX.KLT.DINV.CD.WD
Foreign direct investment, net inflows (BoP, current US$)
2,024
2,665,000,000
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
1,976
411,736,938.5
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
1,977
872,086,608.9
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
1,978
1,309,296,997
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
1,979
1,501,616,821
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
1,980
2,047,622,437
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
1,981
2,067,108,154
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
1,982
2,588,121,582
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
1,983
2,940,239,990
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
1,984
2,580,805,664
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
1,985
2,537,092,529
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
1,986
2,446,387,207
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
1,987
2,180,528,076
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
1,988
1,871,958,252
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
1,989
2,017,306,152
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
1,990
2,006,266,968
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
1,991
1,548,698,364
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
1,992
1,573,619,019
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
1,993
1,446,277,100
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
1,994
1,749,277,100
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
1,995
1,712,219,435.60135
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
1,996
1,284,050,241.16386
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
1,997
1,707,282,924.73027
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
1,998
1,172,000,000
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
1,999
996,000,000
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
2,000
1,075,000,000
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
2,001
1,461,000,000
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
2,002
3,554,000,000
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
2,003
3,964,000,000
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
2,004
3,945,000,000
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
2,005
4,280,000,000
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
2,006
5,121,000,000
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
2,007
5,998,000,000
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
2,008
7,039,000,000
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
2,009
8,717,000,000
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
2,010
9,690,000,000
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
2,011
12,263,000,000
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
2,012
14,007,000,000
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
2,013
14,629,000,000
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
2,014
17,244,000,000
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
2,015
19,306,000,000
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
2,016
19,819,000,000
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
2,017
19,856,000,000
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
2,018
21,193,000,000
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
2,019
22,252,000,000
current_usd
BX.TRF.PWKR.CD.DT
Personal remittances, received (current US$)
2,020
26,089,000,000
current_usd
End of preview.

Pakistan Macroeconomic Indicators (Time Series)

Long-format annual time series of Pakistan macroeconomic indicators compiled from the World Bank Open Data / World Development Indicators API.


Source: OpenDoc Pakistan

Pakistan Macroeconomic Indicators (Time Series)

Summary

This dataset is a long-format annual time series of Pakistan macroeconomic indicators compiled from the World Bank Open Data / World Development Indicators (WDI) API. It covers GDP, GDP per capita, GDP growth, consumer inflation, foreign direct investment, personal remittances, unemployment, total reserves, exports, and imports from 1960 to 2025 where observations are available.

Dataset Details

  • Dataset ID: pakistan-macroeconomic-indicators
  • Version: 1.1.0
  • Category: Economy and Finance
  • Tags: economics, macroeconomics, gdp, inflation, trade, remittances, reserves, pakistan, time-series
  • Language: English
  • Geography: Pakistan (national aggregate)
  • Time Period: 1960 - 2025
  • File Formats: CSV
  • Records: 600 observations across 10 indicators
  • Update Frequency: Annual
  • Maintainer: OpenDoc Data Stewardship Team

Source and Provenance

  • Source Name: World Bank Open Data - World Development Indicators (WDI)
  • Source URL: https://data.worldbank.org/country/pakistan
  • Source Type: Public open-data API (https://api.worldbank.org/v2/country/PAK/indicator/...)
  • Collection Method: Programmatic download of per-indicator JSON responses for country PAK, filtered to non-null observations.
  • Collection Date: July 4, 2026
  • Processing Pipeline: Merged per-indicator API responses into a single long-format table (indicator_code, indicator_name, year, value, unit), dropped null values, added unit labels, sorted by indicator and year.
  • Raw Data Availability: Fully public via the World Bank API.

License

  • Original License: CC BY 4.0 (World Bank Open Data Terms of Use)
  • Repository License: Creative Commons Attribution 4.0 International (CC BY 4.0)
  • Attribution Required: Yes
  • Commercial Use: Allowed
  • Redistribution: Allowed
  • Restrictions: Must credit the World Bank and OpenDoc Pakistan.

Intended Use

Appropriate for:

  • Macroeconomic trend analysis and forecasting.
  • Feature engineering for country-level economic, finance, development, and policy models.
  • Teaching examples for long-format time-series analysis.

Out-of-Scope Use

  • Real-time financial trading or investment advice; values are annual national aggregates and may lag.
  • Sub-national fiscal or economic analysis; values are national aggregates.
  • Interpreting provisional or revised years without checking the latest World Bank metadata.

Data Structure

Single CSV at data/processed/macroeconomic_indicators.csv in long format. One row represents one indicator-year observation.

Columns:

  • indicator_code: World Bank WDI indicator code.
  • indicator_name: World Bank indicator name.
  • year: Gregorian calendar year.
  • value: Numeric observation.
  • unit: Curated unit label.

Indicators included:

  • BX.KLT.DINV.CD.WD: Foreign direct investment, net inflows (BoP, current US$)
  • BX.TRF.PWKR.CD.DT: Personal remittances, received (current US$)
  • FI.RES.TOTL.CD: Total reserves (includes gold, current US$)
  • FP.CPI.TOTL.ZG: Inflation, consumer prices (annual %)
  • NE.EXP.GNFS.CD: Exports of goods and services (current US$)
  • NE.IMP.GNFS.CD: Imports of goods and services (current US$)
  • NY.GDP.MKTP.CD: GDP (current US$)
  • NY.GDP.MKTP.KD.ZG: GDP growth (annual %)
  • NY.GDP.PCAP.CD: GDP per capita (current US$)
  • SL.UEM.TOTL.ZS: Unemployment, total (% of total labor force)

Data Dictionary

See data_dictionary.csv.

Quality Report

  • Quality Score: 100 / 100
  • Rating: Excellent
  • Missing Values: Null observations removed; coverage varies by indicator and year.
  • Duplicate Rows: 0% (primary key: indicator_code + year).
  • Validation Status: Passed CSV integrity validation.
  • Known Issues: World Bank API calls for official exchange rate (PA.NUS.FCRF), current-account balance (BN.CAB.XOKA.CD), and external debt stocks (DT.DOD.DECT.CD) returned repeated gateway/time-out errors during the July 4, 2026 build and are not included in v1.1.0.

Privacy and Sensitivity Review

  • Privacy Level: P0 (aggregate national statistics, no personal data)
  • Personal Data Present: No
  • Sensitive Data Present: No
  • Redactions Applied: None
  • Reviewer: OpenDoc Data Stewardship Team
  • Review Date: July 4, 2026

Bias, Gaps, and Limitations

  • National aggregates hide provincial, sectoral, urban/rural, and income-group differences.
  • Some indicators are modelled estimates and may be revised by the World Bank.
  • Indicator coverage is uneven: not every metric has observations back to 1960.
  • Values are calendar-year WDI series and may not align with Pakistan fiscal-year reporting.

Example Usage

import pandas as pd

df = pd.read_csv("data/processed/macroeconomic_indicators.csv")

inflation = df[df["indicator_code"] == "FP.CPI.TOTL.ZG"]
print(inflation[["year", "value"]].tail(10))

Citation

World Bank, "World Development Indicators - Pakistan", curated as "Pakistan Macroeconomic Indicators" by OpenDoc Pakistan (OpenDoc), v1.1.0, 2026.
Downloads last month
18