import googlesearch as gs import pandas as pd # Define the list of keywords keywords = ["keyword1", "keyword2", "keyword3"] # Use Google Search API to retrieve search volume data search_results = [] for keyword in keywords: query = gs.build("keyword search volume " + keyword) result = gs.search(query)[0] search_results.append(result) # Process the search results and store them in a dataframe df = pd.DataFrame(columns=["Keyword", "Search Volume"]) for i in range(len(search_results)): keyword = keywords[i] search_volume = int(search_results[i].split(" ")[0]) df.loc[i] = [keyword, search_volume] # Print the dataframe print(df)