473,387 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How do I import a dataset into jupyter notebook from a URL?

3 2Bits
I have tried these two codes and none of them seems to work. Can any of you help?

Expand|Select|Wrap|Line Numbers
  1. from numpy import loadtxt
  2. from urlib.request import urlopen
  3.  
  4. url= 'https://think.cs.vt.edu/corgis/datasets/python/electricity/electricity.data'
  5.  
  6. raw_data = urlopen(url)
  7. dataset = loadtxt(raw_data, dtype = 'str', delimiter = ",")
  8.  
  9. print(dataset.shape)
  10. print()
  11. print(dataset[1:20])
Expand|Select|Wrap|Line Numbers
  1. import requests
  2. import pandas as pd
  3. URL ='https://think.cs.vt.edu/corgis/datasets/python/electricity/electricity.data'
  4. r = requests.get(URL)
  5. # a= eval(r.content) Never user eval for online texts
  6. df = pd.DataFrame(r.json())
Dec 7 '20 #1
0 3121

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: F. GEIGER | last post by:
Hi again, I'd like to rename a page of a notebook. Deleting the page and adding a new one is not really an option, because the page is filled with other controls already. So I looked into...
0
by: dimitri pater | last post by:
Hello, To be honest, I also posted this on the wxPython mailing list. But I thought maybe some of you on the python list can help me... I am trying to refresh a pane of a notebook that contains...
8
by: Kreedz | last post by:
Hi I've got some really weird issue with a sizer, a text field and a notebook. Here's an example: import wx class A(wx.Panel): def __init__(self, parent, id): wx.Panel.__init__(self,...
1
by: Ed Bacon | last post by:
I am trying to produce a generic "audit report" for various transactions in our application. Each transaction type defines a document (and has an associated schema). When a transaction leads to a...
4
by: Iain Kirk | last post by:
Being a bit of a novice any help or pointers would be appreciated. I am building a web page that populates a DropDowList from a table in SQL, for testing purposes i have a simple page that...
2
by: David Richards | last post by:
Hi, I was wondering if anyone could help me. I have DataSet that contains the following data tables Customers, Calls, Quotes, QuoteDetails, Competitors, Contacts, Notes, and I have setup...
1
by: zxo102 | last post by:
Hi everyone, I have tried two days to figure out how to draw the image in wx.BufferedDC on the page created by AddPage of wx.Notebook but still got no clue. The attached example works fine. If...
0
by: makequickdraw | last post by:
Hi! I'm in the middle of practice with google quickDraw Datasets. as it says on the site, I could get 'The Eiffel Tower.bin' image array like this. and so on The way I understand this...
1
by: ck25python | last post by:
Hi There, I have thousands of dictionaries saved in one jupyter notebook (controlled by IT), and i would like to utitlize some of the dicitonies in to my jupyter notebook.Is there a way i can...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.