无法查看所有用户输入值

时间:2018-09-27 05:02:08

标签: python python-3.x pandas

我正在自动化自己的东西,为此我陷入了困境。 无论如何解释,我使用的是用户输入,其中一些公式在相应的单元格中用于输出,但是当查看最终输出时,它仅反映了循环的最后一个输入值。

我希望最终的输出包含所有提交的值。

df1 = pd.read_excel('abc.xlsx',worksheet='sheet1')

loops = int(input("Total Outage in Month: "))
inputs = []
for x in range(loops):
    user_input1 = [input('Enter the Impacted_Device : ') ]
    user_input2 = [input('Number_of_Impacted_Connection :') ]
    user_input3 = [input('Outage_Minutes  :')]

    inputs.append(user_input1)
    inputs.append(user_input2)
    inputs.append(user_input3)
    break


Impacted_Device = input(str("Enter the Impacted_Device : "))
Number_of_Impacted_Connection = int(input("Number_of_Impacted_Connection : "))
Outage_Minutes = int(input("Outage_Minutes : "))
Connection_Outage = int(Number_of_Impacted_Connection * Outage_Minutes)


df1['Impacted Connections'] = np.where((df1['Router'].str.contains(Impacted_Device)== True),Number_of_Impacted_Connection,'None')
df1['Outage Minutes'] = np.where((df1['Router'].str.contains(Impacted_Device)== True),Outage_Minutes,'None')
df1['Connection Outage'] = np.where((df1['Router'].str.contains(Impacted_Device)== True),Connection_Outage,'None')

df1

0 个答案:

没有答案