I have a CSV that has a column of URLs and I'm trying to slice out some unnecessary characters leading and trailing characters. I'm using the following syntax:
df.['column_name'].str[3:10]
Unfortunately I get TypeError: 'method' object is not subscriptable
.
pandas
has a function to slice
the entire column values, and is as follows:
df['column_name'].str.slice(start=3, stop=10)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With