In my code, if the list katalogLinks
is empty, I want to add a new row to the df
with the url and a 0
value for the potential client
column.
Else, if the len is more than 0, I want to add a new row with the url and a 1
value for the potential client column.
def findInfo(url, df):
katalogLinks = ["firdt", "es"]
if len(katalogLinks) == 0:
df["Company URL"] = url
df["Potential Client"] = 0
else:
print("nullfjo")
df["Company URL"] = url
df["Potential Client"] = 1
df = pd.DataFrame()
df["Company URL"] = ""
df["Potential Client"] = ""
findInfo("https://www.eltako.de/", df)
df.head()
I am passing a new df into my function. However, the df.head() never shows any rows. Perhaps because the changes to the df are not saved. How can I fix this? I donot want to return the df value from the function itself since I might have to use the findInfo function in a loop. Hence, I want that everytime, it just adds values to the next possible row. Is it possible?
I tried this too but I still get an empty df
df.append(pd.DataFrame({"Company URL":[url],
"Potential Client":[1]}))