Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to go from a url with a zip file to a csv

from urllib import request
import zipfile

# link to the zip file
link = 'https://cricsheet.org/downloads/'
# the zip file is named as ipl_csv2.zip
request.urlretrieve(link, 'ipl_csv2.zip')
compressed_file = zipfile.ZipFile('ipl_csv2.zip')

# I need the csv file named all_matches.csv from ipl_csv2.zip
csv_file = compressed_file.open('all_matches.csv')
data = pd.read_csv(csv_file)
data.head()
Comment

PREVIOUS NEXT
Code Example
Python :: open pdf from pyqt in the same folder 
Python :: pyspark imputer 
Python :: reshaping a image vector/matrix 
Python :: how do you change a class variable in python 
Python :: python import problem fix 
Python :: sensing keyboard shortcuts using python 
Python :: Access value 
Python :: python identation 
Python :: accessing list python 
Python :: plotly showing routes 
Python :: negative index python 
Python :: meaning of self keyword in user defined function 
Python :: pandas count vvariables of each dtype 
Python :: import * with __import__ 
Python :: cara ambil 2 kata menggunakan phyton 
Python :: Comparing Sets with isdisjoint() Function in python 
Python :: opencv minimum of two images python 
Python :: is boolean number python 
Python :: valueerror python list 
Python :: print anything in python 
Python :: Create New Entry Into Table Django 
Python :: multiplying float variables python and print 
Python :: Boolean comparison w/out if statements 
Python :: what is self in python constructor 
Python :: if else ifadesi 
Python :: non venomous snakes 
Python :: animal quiz game in python 
Python :: flask extends two base.html 
Python :: pyspark mapreduce dataframe 
Python :: iterating over the two ranges simultaneously 
ADD CONTENT
Topic
Content
Source link
Name
2+2 =