Skip to main content

Python Event Studies

Python package for conducting event studies over the CRSP database. Enable easy studies with standards methodologies but also implements the one in the paper .

The package do not contains the data, you need to download the data from CRSP.

To install the package use the following command:

pip install py_event_studies

In order to use the package, here is how you can use it:

import py_event_studies as pes

# Load the data (supports csv or parquet files)
# This step will take a little bit of time as it will not only load the data but also preprocess it by pivoting the table in order to be more efficient afterwards.
# It will save a cache file so if you reload the same path it will use the cache. If you changed the data pass the argument no_cache=True
pes.load_data('path/to/your/data.csv')

#If you want to use the Fama-French factors (optional, this step is however very fast as the data is not preprocessed)
pes.load_ff_factors('path/to/your/fama_french_factors.csv')

date = '20120816'

# Get the valid permnos at the date, not needed if you already have a list of permnos
valid_permnos = pes.get_valid_permno_at_date(date)

# Compute the event study for a portfolios
results = pes.compute(date, valid_permnos[np.array([1,10,50,23,35, 102, 55, 66, 548,1002])])

# Display the results statistics for standard tests, also available: cs_test_stats (cross sectionnal), bmp_test_stats (Boehmer, Musumeci and Poulsen (1991)), kp_test_stats (Kolari & Pynnönen (2010))
display(results.std_test_stats)

# In order to plot the prediction made by one of the model for a given cluster size (specify one even if it's a model that do not use one as here)
results.plot(5, 'FF5')

# Summary methods will print results of all tests for all models and all cluster sizes
results.summary()

# Finally you can save the results to an excel file with all results and statistics in different sheets to export it for further analysis
results.to_excel('path_to_save_results.xlsx')

License

Shield: CC BY-NC-SA 4.0

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

CC BY-NC-SA 4.0

Metadata

Release files for py_event_studies 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py_event_studies 0.3.0
File Size Uploaded Provenance Actions
py_event_studies-0.3.0.tar.gz 15.4 kB Without provenance Details for py_event_studies-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for py_event_studies 0.3.0
File Interpreter ABI Platform Actions
py_event_studies-0.3.0-py3-none-any.whl Python 3 none any Details for py_event_studies-0.3.0-py3-none-any.whl

Total release size: 33.2 kB

Release files / py_event_studies-0.3.0.tar.gz

Download URL py_event_studies-0.3.0.tar.gz
Size 15.4 kB
Tags Source
SHA-256 checksum
How to use checksums
1824db7a85fed87be031f5df4a890fab34d98ae9d4aa44603e5a9b36818d7201
BLAKE2b-256 checksum
How to use checksums
5bf46dd5b47ef35644ecf682d5af602435cb64d7c48828dff3e9650ce5f89f00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.12.2 Linux/6.8.0-58-generic

Release files / py_event_studies-0.3.0-py3-none-any.whl

Download URL py_event_studies-0.3.0-py3-none-any.whl
Size 17.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6e0cef72e1d4a572014de2e5e79f2edc844ad8dfa6ad0b012e56fbf64a57cce7
BLAKE2b-256 checksum
How to use checksums
27ac7615e4a4a4f80226ac3889951fc44ba6eb7fcff6e83f5be927718017709a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.7.1 CPython/3.12.2 Linux/6.8.0-58-generic

Security for py_event_studies 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page