Python Forum

Full Version: importing zip file on kaggle??
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi everyone,
I am trying to import a zip file on kaggle. But I couldn't do it i tried some solutions but it didn't help. Can you help me about this issue? Thanks.
(Mar-07-2019, 07:35 AM)GuJu Wrote: [ -> ]But I couldn't do it i tried some solutions but it didn't help. Can you help me about this issue?

You really need to start sharing more info with your questions, like code, errors/problem with it, what exactly you have tried to resolve the issue and how/why it doesnt't work, etc.
Hi, the code i used is
df = pd.read_csv('../input/PollenDataset.zip', compression='zip', header=0, sep=',', quotechar='"')
and the error i always get
Error:
FileNotFoundError Traceback (most recent call last) <ipython-input-10-5aa172058c5d> in <module>() ----> 1 df = pd.read_csv('../input/PollenDataset.zip', compression='zip', header=0, sep=',', quotechar='"') /opt/conda/lib/python3.6/site-packages/pandas/io/parsers.py in parser_f(filepath_or_buffer, sep, delimiter, header, names, index_col, usecols, squeeze, prefix, mangle_dupe_cols, dtype, engine, converters, true_values, false_values, skipinitialspace, skiprows, nrows, na_values, keep_default_na, na_filter, verbose, skip_blank_lines, parse_dates, infer_datetime_format, keep_date_col, date_parser, dayfirst, iterator, chunksize, compression, thousands, decimal, lineterminator, quotechar, quoting, escapechar, comment, encoding, dialect, tupleize_cols, error_bad_lines, warn_bad_lines, skipfooter, doublequote, delim_whitespace, low_memory, memory_map, float_precision) 676 skip_blank_lines=skip_blank_lines) 677 --> 678 return _read(filepath_or_buffer, kwds) 679 680 parser_f.__name__ = name /opt/conda/lib/python3.6/site-packages/pandas/io/parsers.py in _read(filepath_or_buffer, kwds) 438 439 # Create the parser. --> 440 parser = TextFileReader(filepath_or_buffer, **kwds) 441 442 if chunksize or iterator: /opt/conda/lib/python3.6/site-packages/pandas/io/parsers.py in __init__(self, f, engine, **kwds) 785 self.options['has_index_names'] = kwds['has_index_names'] 786 --> 787 self._make_engine(self.engine) 788 789 def close(self): /opt/conda/lib/python3.6/site-packages/pandas/io/parsers.py in _make_engine(self, engine) 1012 def _make_engine(self, engine='c'): 1013 if engine == 'c': -> 1014 self._engine = CParserWrapper(self.f, **self.options) 1015 else: 1016 if engine == 'python': /opt/conda/lib/python3.6/site-packages/pandas/io/parsers.py in __init__(self, src, **kwds) 1706 kwds['usecols'] = self.usecols 1707 -> 1708 self._reader = parsers.TextReader(src, **kwds) 1709 1710 passed_names = self.names is None pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader.__cinit__() pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader._setup_parser_source() /opt/conda/lib/python3.6/zipfile.py in __init__(self, file, mode, compression, allowZip64) 1088 while True: 1089 try: -> 1090 self.fp = io.open(file, filemode) 1091 except OSError: 1092 if filemode in modeDict: FileNotFoundError: [Errno 2] No such file or directory: '../input/PollenDataset.zip'
import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

import os
print(os.listdir("../input"))
['honey-bee-pollen', 'flower']


And i add the same dataset(zip) again maybe something wrong. This is the code to look all the zip files.
import zipfile

def main():
    print(zipfile.is_zipfile('../input/flower/flowers.zip')) # it returns True

if __name__ == '__main__': main()
False

And when i use this code
import glob
glob.glob('./*.zip')


[]
(Mar-10-2019, 11:45 AM)GuJu Wrote: [ -> ]FileNotFoundError: [Errno 2] No such file or directory: '../input/PollenDataset.zip'
(Mar-10-2019, 01:07 PM)GuJu Wrote: [ -> ]['honey-bee-pollen', 'flower']
Well, as the error clearly states and your tests confirm - the file is not there...