We developed ehrapy, an open-source Python software framework for the exploratory analysis of electronic health record data. Ehrapy handles various widely used data formats, preprocessing tasks such as imputation of missing data and bias detection, and offers tools for analyses including patient stratification, survival analysis, causal inference and trajectory inference.