Python序列中的周期数

问题描述 投票:0回答:1

我在计算序列中的周期数时出错。我已经尝试过了

series = pd.Series(['how. are. you. today.', 'i. am. fine.', 'thank. you.'])
count = series.str.count('.')

预期结果是

0 4
1 3
2 2

但是我却得到了

0 21
1 12
2 11

我该如何解决?预先谢谢你。

series
1个回答
0
投票
series = pd.Series(['how. are. you. today.', 'i. am. fine.', 'thank. you.'])
count = series.str.count('\.')
© www.soinside.com 2019 - 2024. All rights reserved.