SELECT customerName
FROM customers
WHERE city = 'Las Angeles'
OR Yearly_Income <= 21000;
EVALUATE
SELECTCOLUMNS(
FILTER(
Customer,
Customer[city] = "Las Angeles" || Customers[Yearly Income] <= 21000
),
"CustomerName", Customer[Name]
)
import pandas as pd
df = pd.read_csv('customers.csv') # Example of loading data
# Filter the DataFrame to include rows where city is 'Las Angeles' or Yearly Income is less than or equal to 21,000
result = df[(df['city'] == 'Las Angeles') | (df['Yearly Income'] <= 21000)][['customerName']]
# Convert to a list of lists
result_list = result.values.tolist()
print(result_list)
| John Doe |
| Jane Smith |
| Mary Jones |
| Bob Brown |
FILTER(Customers, Customers[city] = "Las Angeles" || Customers[Yearly Income] <= 21000): Filters the Customers table to include rows where either the city is 'Las Vegas' or Yearly Income is less than or equal to 21,000. SELECTCOLUMNS: Selects the customerName column and returns it as "CustomerName" in the output.
Leave a Comment