Plotting a Spatially Enabled DataFrame w/ datetime column with all NaT values causes exception

888
2
07-30-2019 01:46 PM
JimmyKnowles
Occasional Contributor II

This isn't really a question since this might be the expected behavior, but since I spent a good chunk of time pinpointing the problem, figured I'd share.

I was playing around with SEDFs and had some issues plotting a SEDF that had NaT datetime values. The error it gave was 

  • AttributeError: Can only use .str accessor with string values, which use np.object_ dtype in pandas

This seems to only be an issue if all the values in a datetime column are NaT. I won't go into details why, but there was a datetime column that didn't have a single valid datetime value, all values were null/NaT.

So, the following line of code was causing the error

sdf.spatial.plot(map_widget=m1)‍‍‍
2 Replies
BjørnSteen
New Contributor

Thank you for posting this.   I expired the same thing but with anoter columns.  IAnd 'I have struggeled a lot until I find this post.

0 Kudos
BjørnSteen
New Contributor

Experienced

0 Kudos