Summary
When reading DataFrame data via get_table_data() or query_table_data(), boolean values are returned as strings ("True"/"False"). Converting these back to Python booleans using bool() or pd.Series.astype(bool) incorrectly treats "False" as True because any non-empty string is truthy in Python.
Steps to Reproduce
from nisystemlink.clients.dataframe import DataFrameClient
client = DataFrameClient()
result = client.get_table_data(table_id)
# result.frame.data contains: [["1", "False"], ["2", "True"]]
# Attempting to convert:
bool("False") # Returns True! (incorrect)
Expected Behavior
Boolean string values should convert correctly: "False" → False, "True" → True
Suggested Fix
Add a helper method or conversion utility that uses explicit mapping instead of bool():
_bool_map = {'true': True, '1': True, 'false': False, '0': False}
series.str.strip().str.lower().map(_bool_map)
-
Short-term fix: Add a utility function like frame_to_pandas(result.frame, dtypes={...}) that handles boolean (and other type) conversions safely
-
Long-term fix: Return Arrow/binary data for read operations too, matching the write format — eliminating the JSON string conversion entirely
Environment
Python 3.x
nisystemlink-clients (latest)
Related
This asymmetry exists because writes use Arrow binary format (types preserved) while reads use JSON (all strings). A frame_to_pandas() helper in the SDK would save users from this pitfall.
Summary
When reading DataFrame data via
get_table_data()orquery_table_data(), boolean values are returned as strings ("True"/"False"). Converting these back to Python booleans usingbool()orpd.Series.astype(bool)incorrectly treats"False"asTruebecause any non-empty string is truthy in Python.Steps to Reproduce
Expected Behavior
Boolean string values should convert correctly: "False" → False, "True" → True
Suggested Fix
Add a helper method or conversion utility that uses explicit mapping instead of bool():
Short-term fix: Add a utility function like
frame_to_pandas(result.frame, dtypes={...})that handles boolean (and other type) conversions safelyLong-term fix: Return Arrow/binary data for read operations too, matching the write format — eliminating the JSON string conversion entirely
Environment
Python 3.x
nisystemlink-clients (latest)
Related
This asymmetry exists because writes use Arrow binary format (types preserved) while reads use JSON (all strings). A frame_to_pandas() helper in the SDK would save users from this pitfall.