The 365 Data Science team is proud to invite you to our own community forum. A very well built system to support your queries, questions and give the chance to show your knowledge and help others in their path of becoming Data Science specialists.
Ask
Anybody can ask a question
Answer
Anybody can answer
Vote
The best answers are voted up and moderated by our team

Jupyter notebook

Jupyter notebook

1
Vote
3
Answer

Hello,
I have problem, that i am unable to insert/import  csv/excel file in jupyter. Please tell me how to import that file in detail.
I have already searched on google how to import csv/excel file in jupyter and tried many codes but it couldn’t work. i have installed all the necessary packages which are mentioned in the video.
Thanks.

3 Answers

365 Team
0
Votes

Hi omkar!
Thanks for reaching out.
Can you please support your question with the code you are trying to execute, as well as a screenshot containing the error message? This will help us assist you better.
Hope this helps.
Best,
Martin

0
Votes
Start your code here 
df_used_cars = pd.read_csv("C:/Users/hp/Documents/Data Science/365 Data Science/Data Visualisation/bar_chart_data")

this is code and i am unable to upload screenshot so i am pasting the whole error :


FileNotFoundError                         Traceback (most recent call last)
<ipython-input-4-d3322ed17be0> in <module>
----> 1 df_used_cars = pd.read_csv("C:/Users/hp/Documents/DataScience/365DataScience/DataVisualisation/bar_chart_data")

~\anaconda3\lib\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, 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, dialect, error_bad_lines, warn_bad_lines, delim_whitespace, low_memory, memory_map, float_precision)
    674         )
    675 
--> 676         return _read(filepath_or_buffer, kwds)
    677 
    678     parser_f.__name__ = name

~\anaconda3\lib\site-packages\pandas\io\parsers.py in _read(filepath_or_buffer, kwds)
    446 
    447     # Create the parser.
--> 448     parser = TextFileReader(fp_or_buf, **kwds)
    449 
    450     if chunksize or iterator:

~\anaconda3\lib\site-packages\pandas\io\parsers.py in __init__(self, f, engine, **kwds)
    878             self.options["has_index_names"] = kwds["has_index_names"]
    879 
--> 880         self._make_engine(self.engine)
    881 
    882     def close(self):

~\anaconda3\lib\site-packages\pandas\io\parsers.py in _make_engine(self, engine)
   1112     def _make_engine(self, engine="c"):
   1113         if engine == "c":
-> 1114             self._engine = CParserWrapper(self.f, **self.options)
   1115         else:
   1116             if engine == "python":

~\anaconda3\lib\site-packages\pandas\io\parsers.py in __init__(self, src, **kwds)
   1889         kwds["usecols"] = self.usecols
   1890 
-> 1891         self._reader = parsers.TextReader(src, **kwds)
   1892         self.unnamed_cols = self._reader.unnamed_cols
   1893 

pandas\_libs\parsers.pyx in pandas._libs.parsers.TextReader.__cinit__()

pandas\_libs\parsers.pyx in pandas._libs.parsers.TextReader._setup_parser_source()

FileNotFoundError: [Errno 2] File C:/Users/hp/Documents/DataScience/365DataScience/DataVisualisation/bar_chart_data does not exist: 'C:/Users/hp/Documents/DataScience/365DataScience/DataVisualisation/bar_chart_data'

 

 

file directory  is correct but it’s still showing the error

Having exactly the same issue (same error code). Using “Examing the data” in Python Time Series. Saved the Jupyter file & CSV in the Python Scripts folder.

4 weeks

365 Team

Hi omkar and Dan!
Thanks for reaching out!
@omkar: Please make sure to add the file extension at the end of the string. Then, please retry.

'.../bar_chart_data.csv")

@Dan: Can you please support your question with a screenshot? This will help us assist you better.
Please note that replacing your file into a folder with a shorter path might solve the problem  in some occasions.
Hope this helps but please feel free to get back to us should you need further assistance. Thank you.
Best,
Martin

Hi Martin, below is the error message i get.
import pandas as pd
import numpy as np
#import matplotlib.pyplot as plt
#import seaborn as sns
#sns.set()

raw_csv_data = pd.read_csv(“Index2018.csv”)
—————————————————————————
NameError Traceback (most recent call last)
in
—-> 1 raw_csv_data = pd.read_csv(“Index2018.csv”)

NameError: name ‘pd’ is not defined

2 weeks

or; import pandas as pd
import numpy as np
raw_csv_data = read_csv(“Index2018.csv”)
—————————————————————————
NameError Traceback (most recent call last)
in
—-> 1 raw_csv_data = read_csv(“Index2018.csv”)

NameError: name ‘read_csv’ is not defined

2 weeks

Hi Dan! This simply means you have note executed 'import pandas as pd' yet. I.e. your code seems correct, but probably not all lines from it have been executed at the moment in which you've executed 'raw_csv_data = pd.read_csv("Index2018.csv"). The second error stems from the fact that you've missed adding "pd." to designate where the "read_csv" method is coming from, so to speak. Hope this helps but please feel free to get back to us should you need further assistance. Thank you. Best,Martin

2 weeks
×
Ready to Learn
Data Science?
50% OFF