@@ -158,14 +158,9 @@ def from_mapping_set_document(cls, doc: MappingSetDocument) -> "MappingSetDataFr
158
158
df = pd .DataFrame (get_dict_from_mapping (mapping ) for mapping in doc .mapping_set .mappings )
159
159
meta = _extract_global_metadata (doc )
160
160
161
- if pandas_version >= (2 , 0 , 0 ):
162
- # For pandas >= 2.0.0, use the 'copy' parameter
163
- df = df .infer_objects (copy = False )
164
- else :
165
- # For pandas < 2.0.0, call 'infer_objects()' without any parameters
166
- df = df .infer_objects ()
167
161
# remove columns where all values are blank.
168
162
df .replace ("" , np .nan , inplace = True )
163
+ df = df .infer_objects ()
169
164
df .dropna (axis = 1 , how = "all" , inplace = True ) # remove columns with all row = 'None'-s.
170
165
171
166
slots = _get_sssom_schema_object ().dict ["slots" ]
@@ -1493,3 +1488,12 @@ def safe_compress(uri: str, converter: Converter) -> str:
1493
1488
:return: A CURIE
1494
1489
"""
1495
1490
return converter .compress_or_standardize (uri , strict = True )
1491
+
1492
+
1493
+ def pandas_set_no_silent_downcasting (no_silent_downcasting = True ):
1494
+ """Set pandas future.no_silent_downcasting option. Context https://github.com/pandas-dev/pandas/issues/57734."""
1495
+ try :
1496
+ pd .set_option ("future.no_silent_downcasting" , no_silent_downcasting )
1497
+ except KeyError :
1498
+ # Option does not exist in this version of pandas
1499
+ pass
0 commit comments