-2

I am really new to python. I have to use python for my research class, so I WAS learning pandas by using resource of Pandas Data Science 100 questions.

I was working on a question that

"P-015: From dataset(df_cutomer), retrieve data in (status_cd)which starts from A-F, and end by 1-9. Displays the first 10 of the data. "

The answer says

df_customer.query("status_cd.str.contains(r'^[A-F].*[1-9]$')", engine='python').head(10)

I know the . is connecting two arguments, but was not sure what * means in this. The question is translated from Japan, and I am pretty new to python. It might really dumb question, but please answer for me.

esabo
  • 49
  • 3

1 Answers1

0

Let's look at an online regex visualizer

enter image description here

https://regexper.com/#'%5E%5BA-F%5D.*%5B1-9%5D%24'

Customer must start with A to F and have anything in between the last character of 1 to 9.

In particular, .* just means "0 or more of any character".

Scott Boston
  • 147,308
  • 15
  • 139
  • 187