Python is a widely-used high-level programming language that is both powerful and easy to use, and is proving to a major player in large-scale data analytics applications.
WRDS provides a direct interface for Python access, alowing native querying of WRDS data right within your Python program. All WRDS data is stored in a PostgreSQL database, and is available through Python through our custom python module, wrds.
Here is an example of a simple query against the Dow Jones Averages & Total Return Indexes using the wrds python module:
Full usage and many examples are given throughout this section for using Python on the WRDS Cloud.
Alternatively, if you are interested in using Python on your workstation, via Jupyter or Spyder, to access WRDS data remotely, please reference Accessing WRDS Remotely via Python.
In the past, WRDS data was only available as SAS flat files. In this format, these files were accessible to non-SAS clients (such as Python) only via a JDBC interface. While this generally worked well, it proved problematic for memory-intensive programs, and proved impossible for extremely large datasets such as TAQ.
WRDS has now made all of our data additionally available as a series of PostgreSQL databases, which has significantly opened up research options for other, non-SAS programming languages such as Python, R, MATLAB, and Stata. Java and JDBC drivers are no longer required for Python connectivity, as a native Python wrds module exists to facilitate the connection. Compared to the previous JDBC connection method, the native method is faster, more robust, and capable of handling far larger queries.
Please let us know what you think of the new connection method, and how you're using it in your research!
The WRDS Cloud supports both Python 3 and Python 2; you may use your preference when working with WRDS data. This applies both to working with interactive and batch jobs on the WRDS Cloud.
However, while both are supported, WRDS always recommends the latest version. If you have a choice in your programming, you should use Python 3. If you are just starting out in Python, you should absolutely use Python 3.
All examples in the document are given in Python 3 code.
Across the board at WRDS, Python 3 may be accessed as python3 and Python 2 may be accessed as python2.