I am trying to read WGIData.csv file in a pandas dataframe. WGIData.csv is present inside a zip file which i am downloading from this url
http://databank.worldbank.org/data/download/WGI_csv.zip
But when i tried to read, it throws error BadZipFile: File is not a zip file
Here is my python code
import pandas as pd
from urllib.request import urlopen
from zipfile import ZipFile
class Get_Data():
def Return_csv_from_zip(self, url):
self.zip = urlopen(url)
self.myzip = ZipFile(self.zip)
self.myzip = self.zip.extractall(self.myzip)
self.file = pd.read_csv(self.myzip)
self.zip.close()
return self.file
url = 'http://databank.worldbank.org/data/download/WGI_csv.zip'
data = Get_Data()
df = data.Return_csv_from_zip(url)
['WGIData.csv', 'WGISeries.csv']this might be the problem.