---
name: singapore-mpa-maritime-statistics-ingestion
description: "How to get Singapore MPA maritime statistics data into a pandas DataFrame and Parquet: access, the request, the format, limits, quirks and terms."
---

# Load Singapore MPA vessel-arrivals data into pandas and Parquet

Source entry: https://signal-lab-jet.vercel.app/datasets/singapore-mpa-maritime-statistics
Provider: https://data.gov.sg/collections/394/view
Checked against the provider's documentation: 2026-11-05

## Access
- No account or key. The CKAN datastore_search endpoint returns JSON over HTTPS; an API key only raises the rate limit.

## Request
```bash
curl 'https://data.gov.sg/api/action/datastore_search?resource_id=d_8f264219109e61fffa87ac64dd5a9a65&limit=5'
```

## Format
CKAN datastore_search JSON: a result object with a fields array (month, vessel_type, number_of_vessels, gross_tonnage, _id) and a records array of row objects; result.total holds the full row count.

## Load into pandas and Parquet
Needs Python 3 with requests, pandas and pyarrow.
```python
"""Singapore MPA vessel-arrivals-by-type sample -> pandas -> Parquet. No key.

Uses the public CKAN datastore_search endpoint on data.gov.sg.
"""
import requests
import pandas as pd

URL = "https://data.gov.sg/api/action/datastore_search"
params = {"resource_id": "d_8f264219109e61fffa87ac64dd5a9a65", "limit": 5}
r = requests.get(URL, params=params, timeout=60)
r.raise_for_status()
result = r.json()["result"]
df = pd.DataFrame(result["records"])
df.to_parquet("mpa_vessel_arrivals_sample.parquet", index=False)
print(len(df), "of", result["total"], "rows; sample:", df.iloc[0]["vessel_type"], df.iloc[0]["month"])

```
Run by us on 2026-11-05 (python 3.13.5 | pandas 3.0.6 | pyarrow 26.0.1 | requests 2.34.2). Result: 5 of 3,048 rows; sample: Container, 1995-01

## Limits
- Rate limits: Not stated without a key; the provider says an API key gives higher rate limits.
- The bunker-sales breakdown resource (d_4f5abbf4486bf8e52bbed3be56dde562) uses the same pattern and returned 6,096 rows when checked.

## Quirks
- All datastore fields are typed as text, including numeric ones (number_of_vessels, gross_tonnage); cast them before analysis.
- Resource ids (d_...) can change if MPA republishes a table; confirm current ids on the collection page before relying on them long-term.

## Terms and attribution
- The Singapore Open Data Licence grants a worldwide, perpetual, royalty-free licence to use the datasets, commercially or non-commercially, as long as you credit the source and link to the licence.
- Terms page: https://data.gov.sg/open-data-licence

## Sources
- https://data.gov.sg/open-data-licence: "The Agency grants you a worldwide, perpetual, royalty-free, non-exclusive licence to Use the datasets"
- https://data.gov.sg/open-data-licence: "You must include in your products, applications or websites that Use the datasets, a conspicuous notice acknowledging the source of the datasets and including a link to the most recent version of this Licence."

## Help improve this skill
Missing a source, or see something to improve? Call the MCP tool suggest_source or feedback (or POST /api/suggest or /api/feedback). Reviewed ideas: https://signal-lab-jet.vercel.app/agent-suggestions

Information for educational purposes only. Free tiers, limits and licenses belong to the providers and may change; check the provider's own terms before using the data.
