Skip to content

Commit

Permalink
fix(dataframe): enable epw dataframe without loaded data
Browse files Browse the repository at this point in the history
this is part of a fix for a bug found by @eapuertoc

fix #154
  • Loading branch information
AntoineDao committed Jun 6, 2021
1 parent 2823edd commit 0d118fb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions ladybug_pandas/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ def from_epw(
Returns:
pd.DataFrame -- A pandas dataframe. Each column will have a type of LadybugArrayType
"""
if not epw.is_data_loaded:
epw._import_data()

df = cls(epw._data[6:])

df = df.replace(999999999.0, np.nan)
Expand Down
7 changes: 5 additions & 2 deletions tests/op_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,16 @@ def test_from_collections(epw):

df = DataFrame([epw.dry_bulb_temperature, epw.direct_normal_radiation])

def test_from_epw_with_loaded_data(epw):
df = DataFrame.from_epw(epw)
# should not raise

def test_from_epw(epw):

def test_from_epw_without_loaded_data(epw):
epw_path = 'tests/assets/epw/tokyo.epw'
epw = EPW(epw_path)
df = DataFrame.from_epw(epw)

# should not raise

def test_si_from_si(temp_series):

Expand Down

0 comments on commit 0d118fb

Please sign in to comment.