SELECT customerName, country
FROM customers
WHERE country LIKE '%S';
EVALUATE
SELECTCOLUMNS(
FILTER(
Customer,
RIGHT(Customer[CountryRegion], 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 ends with 'S'
result = df[df['country'].str.endswith('S')][['customerName', 'country']]
# Convert to a list of lists
result_list = result.values.tolist()
print(result_list)
| John Doe | United States |
| Mary Jones | Netherlands |
FILTER(Customers, RIGHT(Customers[CountryRegion], 1) = "S"): Filters the Customers table to include rows where the country ends with the letter 'S'. SELECTCOLUMNS: Selects the customerName and country columns and returns them as "CustomerName" and "Country" in the output
Leave a Comment