Skip to content

Commit

Permalink
Merge branch 'main' of github.com:wharton/wrds
Browse files Browse the repository at this point in the history
  • Loading branch information
FlipperPA committed Jan 31, 2024
2 parents eb897d9 + 61d659a commit f0ca632
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
36 changes: 18 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# WRDS Python Data Access Library
# WRDS-Py from Wharton Research Data Services

WRDS-Py is a Python package for examining datasets on the [Wharton Research Data Services (WRDS)](https://wrds-www.wharton.upenn.edu) platform, and extracting it to Pandas dataframes. A WRDS account is required.
WRDS-Py is a Python package for examining datasets on the [Wharton Research Data Services (WRDS)](https://wrds-www.wharton.upenn.edu) platform, and extracting data to Pandas dataframes. A WRDS account is required.

## Installation

Before installing the WRDS-Py package, make sure you have a supported version of Python. At a command line interface, type `python --version`, and make sure it is 3.8 or higher.
The WRDS-Py package requires Python 3.8 or newer. To ensure you have a supported Python version, type `python --version` at a command line interface, and check that it is greater than 3.8. On some systems, Python may be in installed as `python3`. You can [download Python here](https://www.python.org/downloads/) if it isn't installed.

The WRDS-Py package must be installed before it can be used for the first time. The best way to do this is to use a [virtual environment](https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/), or `venv`, so you can `import` it to use in Python. In this example, we will show the a Linux prompt (`$`), This example will also [install IPython](https://ipython.org/), which provides a nice command-line interface.
The WRDS-Py package must be installed before it can be used for the first time. The recommended method is to use a [virtual environment](https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/) (`venv`), so you can `import` it to use in Python. This example will install the WRDS-Py package (`wrds`) and [IPython](https://ipython.org/), which provides a much nicer command line interface than is included with Python.

#### Linux or MacOS

Expand Down Expand Up @@ -47,37 +47,37 @@ For detailed information on use of the module, please see [Querying WRDS Data us
A quick tutorial:

```
>>> import wrds
>>> db = wrds.Connection()
In [1]: import wrds
In [2]: db = wrds.Connection()
Enter your credentials.
Username: <your_username>
Password: <your_password>
>>> db.list_libraries()
In [3]: db.list_libraries()
['audit', 'bank', 'block', 'bvd', 'bvdtrial', 'cboe', ...]
>>> db.list_tables(library='crsp')
In [4]: db.list_tables(library="crsp")
['aco_amda', 'aco_imda', 'aco_indfnta', 'aco_indfntq', ...]
>>> db.describe_table(library='crsp', table='stocknames')
In [5]: db.describe_table(library="crsp", table="stocknames")
Approximately 58957 rows in crsp.stocknames.
name nullable type
0 permno True DOUBLE PRECISION
1 permco True DOUBLE PRECISION
2 namedt True DATE
0 permno True DOUBLE PRECISION
1 namedt True DATE
2 nameenddt True DATE
...
>>> stocknames = db.get_table(library='crsp', table='stocknames', rows=10)
>>> stocknames.head()
In [6]: stocknames = db.get_table(library="crsp", table="stocknames", rows=10)
In [7]: stocknames.head()
permno permco namedt nameenddt cusip ncusip ticker \
0 10000.0 7952.0 1986-01-07 1987-06-11 68391610 68391610 OMFGA
1 10001.0 7953.0 1986-01-09 1993-11-21 36720410 39040610 GFGC
2 10001.0 7953.0 1993-11-22 2008-02-04 36720410 29274A10 EWST
3 10001.0 7953.0 2008-02-05 2009-08-03 36720410 29274A20 EWST
4 10001.0 7953.0 2009-08-04 2009-12-17 36720410 29269V10 EGAS
>>> db.close() # Close the connection to the database...
In [7]: db.close() # Close the connection to the database.
>>> with wrds.Connection() as db: # You can use a context manager
... stocknames = db.get_table(library='crsp', table='stocknames', rows=10)
>>> stocknames.head()
In [8]: with wrds.Connection() as db: # You can use a context manager
...: stocknames = db.get_table(library='crsp', table='stocknames', rows=10)
...: stocknames.head()
permno permco namedt nameenddt cusip ncusip ticker \
0 10000.0 7952.0 1986-01-07 1987-06-11 68391610 68391610 OMFGA
1 10001.0 7953.0 1986-01-09 1993-11-21 36720410 39040610 GFGC
Expand Down
12 changes: 6 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ authors = [
]
license = {text = "BSD-3-Clause"}
readme = "README.rst"
requires-python = ">=3.7"
requires-python = ">=3.8"
keywords = ["wrds", "finance", "research", "crsp", "compustat"]
classifiers = [
"Programming Language :: Python",
Expand All @@ -37,12 +37,12 @@ classifiers = [
"License :: OSI Approved :: BSD License",
]
dependencies = [
"numpy<1.27",
"numpy>=1.26,<1.27",
"packaging<23.3",
"pandas<2.3",
"psycopg2-binary<2.10",
"scipy<1.13",
"sqlalchemy<2.1",
"pandas>=2.2,<2.3",
"psycopg2-binary>=2.9,<2.10",
"scipy>=1.12,<1.13",
"sqlalchemy>=2,<2.1",
]
dynamic = ["version"]

Expand Down

0 comments on commit f0ca632

Please sign in to comment.