所以我已经在这个程序上工作了一段时间,由于某种原因,Spyder (Anaconda) 无法运行该程序。我猜这有点像一个未闭合的循环,但我无法查明任何东西,因为 Spyder 甚至不会给我一个错误。只是无法运行程序。这是完整的程序:
import pandas as pd
df = pd.read_csv(r"C:\Users\user\Desktop\Small_businesses1.csv",encoding='latin1')
#create start menu
def menu():
print("Hello!, Welcome to business analysis, how may we help you?")
print("A) Help you find a local business based on your criteria?")
print('B) Provide you with performance analytics of businesses and industries around you?')
print('C) To access and read an excerpt from our data file:')
print('D) Provide you an exit from the interface')
menu()
option = str(input("Kindly enter your option here: "))
while option != 0:
if option == "A":
print="providing you with local businesses now, please input criteria:"
df=pd.read_csv('small businesses.csv')
w=str(input('enter name here'))
df = pd.DataFrame({"name": ['Starz Café','V lounge salon','Swapnil Tyres','Game Dome','Pride Super Shopee','Lifeberries healthcare' ,'365 medical','Mad momoz','Monde Collections','Studio Hub IT','Healer Armis','Tumbledry Laundry','VCF healthclub','Max link Sports','Creamstone' ,"Archie's","Milano's café",'Café old skool','Rebellion Apprel','D.C books','Agrwal Sweets','grocers','Ronak super mart','Vision stationary']})
while (w in df):
print(w)
if w=='':
break
if w!=0:
print("Please enter a valid input from the given list")
x=str(input('enter field here'))
df = pd.DataFrame({"field": ['Food & Hospitality','Beauty, health, fitness','Automotive Repair','Sports & Recreation','General Retail','Medical Services','Medical Services (pharmacy)','Food & Hospitality','General Retail','Technology','Medical services','Cleaning and Maintance','Health, beauty and Fitness','Health, beauty and Fitness','Food & Hospitality','General Retail','Food & Hospitality','Food & Hospitality','General Retail','Stationary & Education','Food & Hospitality','General Retail','General Retail','Stationary & Education']})
while (x in df):
print(x)
if x=='':
break
if x!=0:
print("Please enter a valid input from the given list")
y=str(input('enter desired operation size here'))
df = pd.DataFrame({"operation size": ['Very small','Moderate-Large' ,'Moderate' ,'Moderate' ,'Small','Moderate' ,'Small','Moderate' ,'Small','Small','Small','Large','Moderate' ,'Moderate' ,'Moderate' ,'Large','Small','Small','Small','Small','Small','Medium','Small','Small']})
while (y in df):
print(y)
if y=='':
break
if y!=0:
print("Please enter a valid input from the given list")
z=str(input('enter preferred mode of service here'))
df = pd.DataFrame({"mode of service": ['Physical dine-in/Online delivery','Physical service','Physical service, Home service','Physcial service','Physical service, Home service','Physical service, Online diagnosis','Physical service','Online delivery','Physical service/remote sevice','Remote/online service','Physical service/diagnosis','Physical service/remote sevice','Physical','Physical','Physical service','Physcial service','Physcial service, Online delivery','Physical service, Online Delivery','Online delivery','Physical service, Home service','Physical service, Home service','Physical service, Home service','Physical service, Home service','Physical service, Home service']})
while (z in df):
print(z)
if z=='':
break
if z!=0:
print("Please enter a valid input from the given list")
if w == '':
print (x + y + z)
if x == "":
print(w + y + z)
elif y == "":
print(w + x + z)
elif z == "":
print(w + x + y)
elif x == "" and y == "":
print(w + z)
elif x == "" and z == "":
print(w + y)
elif y == "" and z == "":
print(w + x)
elif w == "" and x == "":
print(y + z)
elif w == "" and z == "":
print(x + y)
elif w == "" and y == "":
print(x + z)
if option == "B":
#do option B stuff here
if option == "C" :
import csv
f=open('smallbusinesses.csv', 'rt')
myReader = csv.reader(f)
for row in myReader:
print(row)
if option == "D":
print("Thank you for using our interface!")
menu()
option = str(input('kindle enter your option here:'))
print="providing you with local businesses now, please input criteria:"
这是我使用的 .csv 的摘录: 非常感谢任何帮助!