I have a scraping function that returns a dataframe as such: enter image description here
How can i add this dataframe to a global dataframe as to keep extending my dataframe like so: enter image description here
The result should be a function i can run again and again with different arguments to compile data into my dataframe.
`
def getTicketPrices(IPLocation, X, Y):
#Scraping...
df = pd.DataFrame (price_list_cleaned, columns = [IPLocation])
`
I have tried creating a dataframe before the function as such: resultsDF = pd.DataFrame()
and then using trying to use the.concat() method within the function but it returns an empty dataframe...
You can use concat
:
appended_df = pd.DataFrame() # Initilize
appended_df = pd.concat([appended_df, new_df], axis=1)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.