How to read EXCEL file in Python Jupyter Notebook | Pandas

preview_player
Показать описание
How to read EXCEL file in Python Jupyter Notebook | Pandas

About this video: In this video, you will learn How to read EXCEL file in Python Jupyter Notebook

Large Language Model (LLM) - LangChain

Large Language Model (LLM) - LlamaIndex

Machine Learning Model Deployment

Spark with Python (PySpark)

Data Preprocessing (scikit-learn)

Social Media Links

#datascience #machinelearning #python #ai #ml #deeplearning #opencv #imageprocessing #ai #tensorflow #neuralnetworks #deeplearning #pandas
Рекомендации по теме
Комментарии
Автор

Thanks a lot man, I am new to pandas/jupyter notebooks and was having trouble opening an excel file for quite some time. This video was very useful!

nicholasrice
Автор

Helpful video, thank you. Can we not store the excel in the folder of our Jupyter and access it from there in the notebook using pandas?

kavanakundapur
Автор

Thank you so much sir it's beneficial

sundram
Автор

Thank you for helping! The video was easy to understand :-)

jermaineoh
Автор

thanks alot..found this video after wasting 3 hours

mariashoukat
Автор

Hey, can you help?. I'm trying to copy the path and doing it exactly like you're but it is giving an error that "file is not found".

shreyasonkar
Автор


my error is
ileNotFoundError Traceback (most recent call last)
in <module>
----> 1

in wrapper(*args, **kwargs)
309 stacklevel=stacklevel,
310 )
--> 311 return func(*args, **kwargs)
312
313 return wrapper

in read_csv(filepath_or_buffer, sep, delimiter, header, names, index_col, usecols, squeeze, prefix, mangle_dupe_cols, dtype, engine, converters, true_values, false_values, skipinitialspace, skiprows, skipfooter, nrows, na_values, keep_default_na, na_filter, verbose, skip_blank_lines, parse_dates, infer_datetime_format, keep_date_col, date_parser, dayfirst, cache_dates, iterator, chunksize, compression, thousands, decimal, lineterminator, quotechar, quoting, doublequote, escapechar, comment, encoding, encoding_errors, dialect, error_bad_lines, warn_bad_lines, on_bad_lines, delim_whitespace, low_memory, memory_map, float_precision, storage_options)
584 kwds.update(kwds_defaults)
585
--> 586 return _read(filepath_or_buffer, kwds)
587
588

in _read(filepath_or_buffer, kwds)
480
481 # Create the parser.
--> 482 parser = TextFileReader(filepath_or_buffer, **kwds)
483
484 if chunksize or iterator:

in __init__(self, f, engine, **kwds)
809 = kwds["has_index_names"]
810
--> 811 self._engine =
812
813 def close(self):

in _make_engine(self, engine)
1038 )
1039 # error: Too many arguments for "ParserBase"
-> 1040 return mapping[engine](self.f, **self.options) # type: ignore[call-arg]
1041
1042 def _failover_to_python(self):

in __init__(self, src, **kwds)
49
50 # open handles
---> 51 self._open_handles(src, kwds)
52 assert self.handles is not None
53

in _open_handles(self, src, kwds)
220 Let the readers open IOHandles after they are done with their potential raises.
221 """
--> 222 self.handles = get_handle(
223 src,
224 "r",

in get_handle(path_or_buf, mode, encoding, compression, memory_map, is_text, errors, storage_options)
700 if ioargs.encoding and "b" not in ioargs.mode:
701 # Encoding
--> 702 handle = open(
703 handle,
704 ioargs.mode,

FileNotFoundError: [Errno 2] No such file or directory:
bro please help me bro

venkatexplorermetturdam
Автор

import pandas as pd

df.head()



Getting below error


AttributeError Traceback (most recent call last)
Input In [9], in <cell line: 2>()
1 import pandas as pd
----> 2
3 df.head()

File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\util\_decorators.py:311, in deprecate_nonkeyword_arguments.<locals>.decorate.<locals>.wrapper(*args, **kwargs)
305 if len(args) > num_allow_args:
306 warnings.warn(
307 msg.format(arguments=arguments),
308 FutureWarning,
309 stacklevel=stacklevel,
310 )
--> 311 return func(*args, **kwargs)

File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\excel\_base.py:457, in read_excel(io, sheet_name, header, names, index_col, usecols, squeeze, dtype, engine, converters, true_values, false_values, skiprows, nrows, na_values, keep_default_na, na_filter, verbose, parse_dates, date_parser, thousands, decimal, comment, skipfooter, convert_float, mangle_dupe_cols, storage_options)
455 if not isinstance(io, ExcelFile):
456 should_close = True
--> 457 io = ExcelFile(io, storage_options=storage_options, engine=engine)
458 elif engine and engine != io.engine:
459 raise ValueError(
460 "Engine should not be specified when passing "
461 "an ExcelFile - ExcelFile already has the engine set"
462 )

File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\excel\_base.py:1419, in ExcelFile.__init__(self, path_or_buffer, engine, storage_options)
1416 self.engine = engine
1417 self.storage_options = storage_options
-> 1419 self._reader = self._engines[engine](self._io,

File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\excel\_openpyxl.py:525, in OpenpyxlReader.__init__(self, filepath_or_buffer, storage_options)
514 """
515 Reader using openpyxl engine.
516
(...)
522 passed to fsspec for appropriate URLs (see ``_get_filepath_or_buffer``)
523 """
524
--> 525 super().__init__(filepath_or_buffer,

File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\excel\_base.py:518, in BaseExcelReader.__init__(self, filepath_or_buffer, storage_options)
516 self.handles.handle.seek(0)
517 try:
--> 518 self.book =
519 except Exception:
520 self.close()

File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\pandas\io\excel\_openpyxl.py:536, in OpenpyxlReader.load_workbook(self, filepath_or_buffer)
533 def load_workbook(self, filepath_or_buffer: FilePath | ReadBuffer[bytes]):
534 from openpyxl import load_workbook
--> 536 return load_workbook(
537 filepath_or_buffer, read_only=True, data_only=True, keep_links=False
538 )

File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\openpyxl\reader\excel.py:346, in load_workbook(filename, read_only, keep_vba, data_only, keep_links, rich_text)
316 """Open the given filename and return the workbook
317
318 :param filename: the path to open or a file-like object
(...)
342
343 """
344 reader = ExcelReader(filename, read_only, keep_vba,
345 data_only, keep_links, rich_text)
--> 346 reader.read()
347 return reader.wb

File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\openpyxl\reader\excel.py:303, in ExcelReader.read(self)
301 self.read_worksheets()
302 action = "assign names"
--> 303 self.parser.assign_names()
304 if not self.read_only:
305 self.archive.close()

File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\openpyxl\reader\workbook.py:109, in
107 reserved = defn.is_reserved
108 if reserved is None:
--> 109 sheet.defined_names[name] = defn
111 elif reserved == "Print_Titles":
112 titles =

AttributeError: 'ReadOnlyWorksheet' object has no attribute 'defined_names'

ASHISHSHARMA-mtnj