Since upgrading to version 2.0.1 I have noticed null string fields are automatically converted to the string "None".
df = pd.DataFrame.spatial.from_layer(<valid_layer>)
And I get something like this:
string_column1 | string_column2 | int_column | time_column |
None | None | 2 | 01:54.9 |
None | None | 1 | 23:17.4 |
None | None | 2 | 36:55.4 |
None | None | 1 | 38:04.4 |
How do I disable this behaviour?
Is it literally the string None? Keep in mind that a dataframe will display that for null string fields.
If you want to check, try df.loc[:['string_column1', 'string_column2'].isna() to see which values are truly not there.
Oh, and to your question of "how do I disable" this, just call fillna('') on those columns, and the nulls will be replaced with empty strings, or whatever else you decide to put in.
Yes it is literally the string "None"
That's very strange. Even though from_layer is really just doing FeatureLayer.query(as_df=True) on the back end, I sometimes see inexplicable differences between the two.
Can you try valid_layer.query(as_df=True) to see if it behaves the same way?
I've tried that as well and it gives me the same results.
I've reverted back to a previous version.
And v 2.0.0 doesn't do this? Have you tested it against other sources? I wonder if it's got to do with the underlying DB the data is being stored in. I'm on 2.0.1 and do not see this behavior.
v2.0.0 does not do this. I have tested it on other feature services - same result.
Can you replicate it when using the df.spatial.to_featureclass() or df.to_clipboard() methods?