Skip to content

Commit 6ab580a

Browse files
Create DataFrame object when field value is None (#79)
* fix bug * Update CHANGELOG.md Co-authored-by: Troy Raen <[email protected]> * implement requested changes * update CHANGELOD --------- Co-authored-by: Troy Raen <[email protected]>
1 parent 4430146 commit 6ab580a

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

Diff for: CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
1010

1111
## \[Unreleased\]
1212

13+
### Fixed
14+
15+
- Fix issue #76. Make `Alert.dataframe` succeed even when there are no previous sources.
16+
17+
## \[v0.3.12\] - 2025-03-07
18+
1319
### Added
1420

1521
- Data listings and references for LSST

Diff for: pittgoogle/alert.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -298,9 +298,9 @@ def dataframe(self) -> "pd.DataFrame":
298298
import pandas as pd # always lazy-load pandas. it hogs memory on cloud functions and run
299299

300300
# sources and previous sources are expected to have the same fields
301-
sources_df = pd.DataFrame([self.get("source")] + self.get("prv_sources", []))
301+
sources_df = pd.DataFrame([self.get("source")] + (self.get("prv_sources") or []))
302302
# sources and forced sources may have different fields
303-
forced_df = pd.DataFrame(self.get("prv_forced_sources", []))
303+
forced_df = pd.DataFrame(self.get("prv_forced_sources") or [])
304304

305305
# use nullable integer data type to avoid converting ints to floats
306306
# for columns in one dataframe but not the other

0 commit comments

Comments
 (0)