I have a dictionary as below
city = {"AP":"VIZAG", "TELANGANA":"HYDERABAD"}
and also I have a list which I need to loop for all state tables as below
states = ['AP','HYDERABAD']
for st in states:
df = spark.sql(f"""select * from {st} where city = {city}["{st}"]""")
In above df I am trying to filter city based on dictionary value as per state. But I am not able to do it
'{city[st]}'not{city}["{st}"]