Registry / data / quandl

quandl

JSON →
library3.7.0pypypi✓ verified 88d ago

The `quandl` Python library provides a convenient interface for accessing financial, economic, and alternative datasets from Nasdaq Data Link (formerly Quandl). It allows users to fetch data as Pandas DataFrames or NumPy arrays, facilitating data analysis and integration into quantitative workflows. The library is actively maintained, with the current version being 3.7.0, and new features and fixes are released regularly.

pip install quandl
INSTALL
IMPORT
SIG · QUANDL
Q
quandl
datapythonv3.7.0
Install
8.2s avg
Import
1619ms
Disk
168MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v3.7.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.920 runs
installs and imports cleanly · install 0.0s · import 1.676s · 168.9MB
glibc
py 3.10–3.920 runs
installs and imports cleanly · install 8.2s · import 1.562s · 161MB
168MB installed
● package 168MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

quandl
✓ import quandl
✗ import Quandl
The package name is lowercase, and attempting to import with a capitalized 'Q' will result in an ImportError.
ApiConfig
✓ import quandl quandl.ApiConfig.api_key = 'YOUR_API_KEY'
Used to configure global settings like the API key, which is crucial for authenticated access.

This quickstart demonstrates how to import the `quandl` library, configure your API key (preferably via environment variable), and fetch a sample dataset. Data is returned as a Pandas DataFrame, making it easy to inspect and manipulate. An API key is essential for most practical uses beyond very limited anonymous calls.

import quandl import os # Your Quandl API Key, stored as an environment variable for security API_KEY = os.environ.get('QUANDL_API_KEY', 'YOUR_API_KEY_HERE') if API_KEY == 'YOUR_API_KEY_HERE': print("WARNING: Please set the QUANDL_API_KEY environment variable or replace 'YOUR_API_KEY_HERE' with your actual key.") # For demonstration, proceed with limited anonymous access or raise an error # raise ValueError("Quandl API Key not configured.") quandl.ApiConfig.api_key = API_KEY try: # Fetching historical stock data for Apple from the WIKI database (now deprecated/archived, but good example) # For current data, find up-to-date codes on Nasdaq Data Link website data = quandl.get("WIKI/AAPL", start_date="2015-01-01", end_date="2015-12-31") print(data.head()) except quandl.QuandlError as e: print(f"Error fetching data: {e}") print("Ensure your API key is correct and you have access to the requested dataset.")
Debug
Known issues
breakingSupport for Python 3.3 was removed in `quandl` version 3.4.0. Users on Python 3.3 or older must upgrade their Python environment to at least 3.4 (though >=3.6 is now required by the latest package) to use `quandl` versions 3.4.0 and newer.
fix
Upgrade Python to version 3.6 or later.
affects: >=3.4.0
gotchaAn API key is critical for most practical uses of Quandl. Anonymous users are severely rate-limited (e.g., 50 calls per day). Without a valid API key configured, you will quickly hit limits or fail to access many datasets, receiving 403 Forbidden or similar errors.
fix
Register for a free account on the Nasdaq Data Link website, obtain your API key from your account settings, and set it using `quandl.ApiConfig.api_key = 'YOUR_KEY'` or via the `QUANDL_API_KEY` environment variable.
affects: All versions
gotchaQuandl was acquired by Nasdaq and is now known as Nasdaq Data Link. While the `quandl` Python library still functions to access their data, new users should be aware of the rebranding and seek dataset codes on the Nasdaq Data Link website.
fix
Consult the Nasdaq Data Link website for the most current dataset codes and documentation, even when using the `quandl` library.
affects: All versions since late 2018
gotchaSSL certificate verification was enabled by default in v3.4.8. If you are operating in an environment with custom SSL certificates or proxies, you might encounter SSL errors.
fix
Ensure your environment's SSL certificates are correctly configured or, as a last resort for debugging (not recommended for production), disable SSL verification via `quandl.ApiConfig.verify_ssl_certs = False`.
affects: >=3.4.8
gotchaThe `authtoken.p` file, previously used to persist API keys locally, can be a security concern if not properly managed or if the working directory changes. The recommended modern approach is to set the API key programmatically or via environment variables.
fix
Avoid relying on `authtoken.p`. Explicitly set `quandl.ApiConfig.api_key` in your script or use the `QUANDL_API_KEY` environment variable.
affects: <3.4.3 (older mechanism), generally a configuration gotcha for all versions
Errors
Common errors & fixes
ImportError: No module named Quandl
The Python package name for Quandl is all lowercase (`quandl`). Attempting to import it with a capitalized 'Q' will fail.
fix
Change the import statement to `import quandl` (all lowercase).
ValueError: The Quandl API key must be provided.
You are attempting to access a dataset that requires authentication or have exceeded anonymous call limits without providing a valid API key.
fix
Set your API key using `quandl.ApiConfig.api_key = 'YOUR_API_KEY'` before making data requests. Ensure 'YOUR_API_KEY' is replaced with your actual key from Nasdaq Data Link.
quandl.errors.quandl_error.QuandlError: (Status 403) Something went wrong. Please try again.
This error typically indicates that your API key is invalid, has expired, or you do not have sufficient permissions (e.g., subscription level) to access the requested dataset, or you have exceeded your rate limits.
fix
Verify your API key is correct and active. Check your Nasdaq Data Link account for subscription status and daily call limits. Some datasets require paid subscriptions. If the key is correct, try accessing a free dataset like `WIKI/GOOGL` to isolate the problem.
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
This often occurs when the Quandl API returns an unexpected non-JSON response (e.g., an HTML error page or an empty response) instead of valid JSON data, usually due to an underlying API issue, rate limiting, or an invalid request.
fix
Check the full error message for a `QuandlError` status code (e.g., 403, 500). Ensure your API key is valid, your request parameters are correct, and you are not exceeding rate limits. Temporarily enabling verbose logging might reveal the actual HTTP response body.
Upgrade
Version history
3.7.0latest on PyPI · released Nov 11, 2021
Audit
Dependencies
pandasoptionalData from Quandl is typically returned as Pandas DataFrames, making pandas essential for data manipulation and analysis.
numpyoptionalUsed in conjunction with pandas for numerical operations on the fetched data.
Agent activity
16 hits · last 30 days
node
14
Amazon
1
OpenAI (training)
1
Resources
quandl — pip install quandl · libregistry