Добавление строки к тому же панде - PullRequest
0 голосов
/ 19 октября 2019

Мне нужно сохранить список в одной ячейке Excel. Или добавить строку с введенной ошибкой в ​​тот же DataFrame.

Я попытался добавить все ошибки в список, а затем записать этот список в DataFrame (список должен находиться в одной ячейке). Это вообще возможно?

и затем я попытался добавить новый фрейм данных к старому. Я знаю, что получу двойные ошибки. Есть ли способ добавить данные с помощью iloc.

listOfErrors = []

    #ISKANJE NAPACNO VPISANIH PODATKOV
    errorIme = odpriChrome.find_element_by_xpath('//*[@id="page"]/div/section/article/form/section[2]/div[1]/div[2]/div/div[2]/div').is_displayed() 
    if errorIme == True:
        text= 'Ime;'
        listOfErrors.append(text)
        testDT.loc[customer, 'test'] = listOfErrors

    errorPriimek = odpriChrome.find_element_by_xpath('//*[@id="page"]/div/section/article/form/section[2]/div[2]/div[2]/div/div[2]/div').is_displayed()
    if errorPriimek == True:
        text = 'Priimek;'
        listOfErrors.append(text)
        testDT.loc[customer, 'test'] = listOfErrors

napaka = pd.DataFrame ()

    errorIme = odpriChrome.find_element_by_xpath('//*[@id="page"]/div/section/article/form/section[2]/div[1]/div[2]/div/div[2]/div').is_displayed() 
    if errorIme == True:
        text= 'Ime;'
        testDT.loc[customer, 'test'] = text
        napaka = testDT.iloc[customer]
        testDT = testDT.append(napaka, ignore_index = True)
    errorPriimek = odpriChrome.find_element_by_xpath('//*[@id="page"]/div/section/article/form/section[2]/div[2]/div[2]/div/div[2]/div').is_displayed()
    if errorPriimek == True:
        text = 'Priimek;'
        testDT.loc[customer, 'test'] = text
        napaka = testDT.iloc[customer]
        testDT = testDT.append(napaka, ignore_index = True)

мне нужно получить всеошибки в одной ячейке Excel, или добавлять строки с письменными ошибками. Поэтому, если мой тест обнаружит две ошибки, мне понадобятся две строки с добавленной ошибкой в ​​конце.

Thx

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...