Loading blank fields from DataFrame creates string value 'None'
Closed this issue · 0 comments
sambles commented
Issue Description
When loading a DataFrame to the OedSource class a blank field None
is converted to dtype string "None"
This causes ReinsScope to fail validation on file upload in the OasisPlatform with:
> oed_validation_errors
[{'name': 'ri_scope', 'source': {'source_type': 'DataFrame'}, 'msg': 'invalid CountryCode.\n ReinsNumber PortNumber AccNumber LocNumber CountryCode\n0 1 1 A11111 10002082047 None\n1 1 1 A11111 10002082048 None'}]
Because "None"
is not seen as a valid blank value
> country_only_df
ReinsNumber PortNumber AccNumber PolNumber LocGroup LocNumber ... ProducerName LOB CountryCode ReinsTag CededPercent OEDVersion
0 1 1 A11111 None None 10002082047 ... None None None None 0.1 2.0.0
1 1 1 A11111 None None 10002082048 ... None None None None 0.2 2.0.0
[2 rows x 13 columns]
> country_only_df['CountryCode'][0]
'None'
> type(country_only_df['CountryCode'][0])
<class 'str'>
In the function:
ODS_Tools/ods_tools/oed/source.py
Lines 199 to 231 in a77015d