Skip to content

Commit

Permalink
Merge pull request #9030 from gem/warnings
Browse files Browse the repository at this point in the history
Removed some pandas warnings
  • Loading branch information
micheles authored Sep 25, 2023
2 parents b8bf1aa + a1f924f commit d4775e8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#,,,"generated_by='OpenQuake engine 3.18.0-git00abdf97f8', start_date='2023-09-18T09:11:45', checksum=1056964987"
#,,,"generated_by='OpenQuake engine 3.18.0-git9ab8269ea3', start_date='2023-09-25T07:31:13', checksum=1718747518"
rlz_id,return_period,retention,claim
0,5.00000E+01,0.00000E+00,0.00000E+00
0,1.00000E+02,1.07555E+02,1.07555E+02
0,2.00000E+02,6.33285E+02,6.33285E+02
0,5.00000E+01,5.47169E+01,5.47169E+01
0,1.00000E+02,5.59046E+02,5.59046E+02
0,2.00000E+02,2.20776E+03,2.20776E+03
0,5.00000E+02,2.66082E+03,2.66082E+03
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ truncation_level = 3
maximum_distance = 200.0
investigation_time = 1
number_of_logic_tree_samples = 0
ses_per_logic_tree_path = 200
ses_per_logic_tree_path = 500

[vulnerability]
structural_vulnerability_file = structural_vulnerability_model.xml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ truncation_level = 3
maximum_distance = 200.0
investigation_time = 1
number_of_logic_tree_samples = 0
ses_per_logic_tree_path = 200
ses_per_logic_tree_path = 500

[vulnerability]
structural_vulnerability_file = structural_vulnerability_model.xml
Expand Down
7 changes: 3 additions & 4 deletions openquake/risklib/reinsurance.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ def check_fields(fields, dframe, policyidx, fname, policyfname, treaties,
:param treaty_types: treaty types
"""
key = fields[0]
[indices] = np.where(dframe.deductible.to_numpy() == '')
[indices] = np.where(np.isnan(dframe.deductible.to_numpy()))
if len(indices) > 0:
raise InvalidFile(
'%s (rows %s): empty deductible values were found' % (
policyfname, [idx + 2 for idx in indices]))
[indices] = np.where(dframe.liability.to_numpy() == '')
[indices] = np.where(np.isnan(dframe.liability.to_numpy()))
if len(indices) > 0:
raise InvalidFile(
'%s (rows %s): empty liability values were found' % (
Expand Down Expand Up @@ -234,8 +234,7 @@ def parse(fname, policy_idx):
treaty['limit'].append(limit)
treaty_linenos.append(node.lineno)
policyfname = os.path.join(os.path.dirname(fname), ~rmodel.policies)
df = pd.read_csv(policyfname, keep_default_na=False).rename(
columns=fieldmap)
df = pd.read_csv(policyfname).rename(columns=fieldmap)
df.columns = df.columns.str.strip()
all_policies = df.policy.to_numpy() # ex ['A', 'B']
exp_policies = np.array(list(policy_idx)) # ex ['?', 'B', 'A']
Expand Down

0 comments on commit d4775e8

Please sign in to comment.