Mission-to-Mars:步骤1-抓取使用Jupyter Notebook,BeautifulSoup,Pandas和Re

  • B2_769612
  • 5.8KB
  • zip
  • 0
  • VIP专享
  • 0
  • 2022-05-28 08:46
火星任务 步骤1 使用Jupyter Notebook,BeautifulSoup,Pandas和Requests / Splinter完成初始刮擦。 创建一个名为task_to_mars.ipynb的Jupyter Notebook文件,并使用该文件完成所有的抓取和分析任务。 以下概述了您需要抓取的内容。 NASA火星新闻刮擦NASA火星新闻网站并收集最新的新闻标题和段落文本。 将文本分配给以后可以引用的变量。 在此处访问JPL Featured Space Image的URL。 使用splinter导航站点,找到当前“特色火星”图像的图像url,并将该url字符串分配给一个名为Featured_image_url的变量。 确保找到全尺寸.jpg图片的图片网址。 确保为该图像保存完整的url字符串。 火星事实访问此处的火星事实页面,并使用熊猫刮擦包含有关该行星的事实(包括直径,质量
  • Mission-to-Mars-main
  • app.py
  • README.md
  • Mission_to_Mars_HW.ipynb
  • scrape_mars.py
# Mission-to-Mars STEP 1 Complete your initial scraping using Jupyter Notebook, BeautifulSoup, Pandas, and Requests/Splinter. Create a Jupyter Notebook file called mission_to_mars.ipynb and use this to complete all of your scraping and analysis tasks. The following outlines what you need to scrape. NASA Mars News Scrape the NASA Mars News Site and collect the latest News Title and Paragraph Text. Assign the text to variables that you can reference later. Visit the url for JPL Featured Space Image here. Use splinter to navigate the site and find the image url for the current Featured Mars Image and assign the url string to a variable called featured_image_url. Make sure to find the image url to the full size .jpg image. Make sure to save a complete url string for this image. Mars Facts Visit the Mars Facts webpage here and use Pandas to scrape the table containing facts about the planet including Diameter, Mass, etc. Use Pandas to convert the data to a HTML table string. Mars Hemispheres Visit the USGS Astrogeology site here to obtain high resolution images for each of Mar’s hemispheres. You will need to click each of the links to the hemispheres in order to find the image url to the full resolution image. Save both the image url string for the full resolution hemisphere image, and the Hemisphere title containing the hemisphere name. Use a Python dictionary to store the data using the keys img_url and title. Append the dictionary with the image url string and the hemisphere title to a list. This list will contain one dictionary for each hemisphere. Step 2 - MongoDB and Flask Application Use MongoDB with Flask templating to create a new HTML page that displays all of the information that was scraped from the URLs above. Start by converting your Jupyter notebook into a Python script called scrape_mars.py with a function called scrape that will execute all of your scraping code from above and return one Python dictionary containing all of the scraped data. Next, create a route called /scrape that will import your scrape_mars.py script and call your scrape function. Store the return value in Mongo as a Python dictionary. Create a root route / that will query your Mongo database and pass the mars data into an HTML template to display the data. Create a template HTML file called index.html that will take the mars data dictionary and display all of the data in the appropriate HTML elements. Use the following as a guide for what the final product should look like, but feel free to create your own design.
    • JupyterNotebooks
    • Jupyter学习
    • jupyter
      使用构建后命令启用Jupyter Extensions (Jupyter笔记本) (Jupyter实验室) 该示例演示了如何使用Binder启用Jupyter扩展。我们目前仅在此仓库中介绍一个示例。 请注意,其中某些在启用方式上是不同寻常的。 ...
    • Jupyter部署
    • jupyterNotebook
    • Jupyter
    • jupyter示例
    • Learning Jupyter
      Learning Jupyter.pdf 电子版 高清 非扫描版 有目录 有书签
    • Jupyter
      OpenTopography Jupyter笔记本示例 此存储库包含一些用于处理示例jupyter笔记本。 -OpenTopography最近将其整个全局数据集集合转换为COG。 本笔记本示例重点介绍了Cloud Optimized Geotiffs(COG)的强大功能以及...
    • jupyter