[PYTHON] [Personal memo] Get data on the Web and make it a DataFrame

#Import requests to get data from the web.
import requests

#Use StringIO for CSV data.
from io import StringIO

#The URL of the data.
url = "http://elections.huffingtonpost.com/pollster/2012-general-election-romney-vs-obama.csv"

#Use requests to get the data as text.
source = requests.get(url).text

#Use StringIO to prevent pandas errors.
poll_data = StringIO(source) 

poll_df = pd.read_csv(poll_data)

Recommended Posts

[Personal memo] Get data on the Web and make it a DataFrame
Make a thermometer with Raspberry Pi and make it visible on the browser Part 3
Specify the volume on linux and make a sound
[Python3] Take a screenshot of a web page on the server and crop it further
Get an image from a web page and resize it
Make a BLE thermometer and get the temperature with Pythonista3
Get the matched string with a regular expression and reuse it when replacing on Python3
How to get the current weather data and display it on the GUI while updating it automatically
A memo with Python2.7 and Python3 on CentOS
Make a decision tree from 0 with Python and understand it (4. Data structure)
Upload data to s3 of aws with a command and update it, and delete the used data (on the way)
Try web scraping now and get lottery 6 data
Extract the Azure SQL Server data table with pyodbc and try to make it numpy array / pandas dataframe
Scraping the rainfall data of the Japan Meteorological Agency and displaying it on M5Stack
Define a division value in Django and easily reflect it on the screen
Get the stock price of a Japanese company with Python and make a graph
[CGI] Run the Python program on the server with Vue.js + axios and get the output data
Get the latest schedule from Google Calendar and notify it on LINE every morning
Memo A beginner tried to build a Java environment and Japaneseize it on Ubuntu 18.04.2 LTS.
Let's make a Makefile and build it (super beginner)
Make the model a string on a Django HTML template
Get comments and subscribers with the YouTube Data API
Execute the command on the web server and display the result
Recursively get the Excel list in a specific folder with python and write it to Excel.
I analyzed the rank battle data of Pokemon sword shield and visualized it on Tableau
Extract only the sound of a specific instrument from a MIDI file and make it a separate file
[Personal memo] Install the latest Java on Amazon Linux that already contains Java and switch the version
Memo to get the value on the html-javascript side with jupyter
Associate Python Enum with a function and make it Callable
Put the lists together in pandas to make a DataFrame
Memo "Automate the Boring stuff -chapter5 Dictionaries and Structuring Data"
Get a global IP and export it to Google Spreadsheets
Build a Python environment and transfer data to the server
(Memo) Until you extract only the part you want from a certain Web page, convert it to a Sphinx page, and print it as a PDF
Fixed-point observation of specific data on the Web by automatically executing a Web browser on the server (Ubuntu16.04) (2) -Web scraping-
I want to create a histogram and overlay the normal distribution curve on it. matplotlib edition
It is surprisingly troublesome to get a list of the last login date and time of Workspaces
How to return the data contained in django model in json format and map it on leaflet
Make a thermometer with Raspberry Pi and make it viewable with a browser Part 4
Get data from your website on a regular basis using ScraperWiki
Launched a web application on AWS with django and changed jobs
Prepare a machine learning project format and run it on SageMaker
Get the number of readers of a treatise on Mendeley in Python
Web shop electronic work DIY: Make the night owl TV fine and get an early rising life ①
I tried to push the Sphinx document to BitBucket and it will be automatically reflected on the web server
Web scraping beginners tried to make a command to get the movie name of next Friday Road Show
Get a list of camera parameters that can be set with cv2.VideoCapture and make it a dictionary type
I want to pass an argument to a python function and execute it from PHP on a web server