SELECT customerName, country
FROM customers
WHERE country LIKE '_S%';
EVALUATE
SELECTCOLUMNS(
FILTER(
Customer,
MID(Customer[CountryRegion], 2, 1) = "S"
),
"CustomerName", Customer[Name],
"Country", Customer[CountryRegion]
)
import pandas as pd
df = pd.read_csv('customers.csv')
# Filter the DataFrame to include rows where the country has 'S' as the second character
result = df[df['country'].str.match(r'^.S')][['customerName', 'country']]
# Convert to a list of lists
result_list = result.values.tolist()
print(result_list)
| Mary Jones | USA |
| Bob Brown | USA |
| Alice White | USA |
FILTER(Customers, MID(Customers[country], 2, 1) = "S"): Filters the Customers table to include rows where the second character of the country is 'S'. SELECTCOLUMNS: Selects the customerName and country columns and returns them as "CustomerName" and "Country" in the output.
Leave a Comment