Skip to content

Instantly share code, notes, and snippets.

@mohammedouahman
Created November 19, 2021 16:51
Show Gist options
  • Save mohammedouahman/81421a24cbff1e58f674f6232fd10d47 to your computer and use it in GitHub Desktop.
Save mohammedouahman/81421a24cbff1e58f674f6232fd10d47 to your computer and use it in GitHub Desktop.
results = []
for i in range(1, no_pages+1):
results.append(get_data(i))
flatten = lambda l: [item for sublist in l for item in sublist]
df = pd.DataFrame(flatten(results),columns=['Book Name','Author','Rating','Customers_Rated', 'Price'])
df.to_csv('amazon_products.csv', index=False, encoding='utf-8')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment