Why df[‘col’].str[x:] trips you up and how to cleanly slice strings in pandas columns

You’ve got a pandas DataFrame, a column full of strings, and a simple ask: cut off the first few characters from each row. Sounds straightforward, but if you’ve tried df['column'].str[x:] as an automatic go-to, you might have hit a wall. Why doesn’t that work the way you expect? And how do you do it cleanly... Continue Reading →

Website Powered by WordPress.com.

Up ↑