Series' object has no attribute 'Substring'
时间: 2023-10-30 21:05:31 浏览: 59
It seems like you are trying to use the `Substring` attribute on a Series object, but it is not a valid attribute for that object. The `Substring` method is not available directly on a Series object in Python.
If you want to extract a substring from a Series object, you can use the `str` accessor followed by the desired string method. For example, if you have a Series called `my_series` and you want to extract a substring from each element, you can use the `str.slice` method:
```python
my_series.str.slice(start, stop)
```
Replace `start` and `stop` with the desired indices for your substring.
Alternatively, if you want to apply a substring operation on each element of the Series, you can use the `apply` method with a custom lambda function:
```python
my_series.apply(lambda x: x[start:stop])
```
Again, replace `start` and `stop` with the desired indices for your substring.
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)