Problem importing dataset I am new to machine learning and I am trying to build a classifier. My problem is that I am not able to import the dataset I need. In particular, I put my dataset in the Desktop and what I did is:

#pakages
import numpy as np
import pandas as pd
import jsonlines                   #edit

from sklearn.model_selection import train_test_split
from sklearn.feature_extraction.text import *
from sklearn.naive_bayes import *
from sklearn.metrics import confusion_matrix, classification_report
from sklearn import svm

#for visualizing data
import matplotlib.pyplot as plt
import seaborn as sns; sns.set(font_scale=1.2)

%matplotlib inline

print('Libraries imported.')


now, after these imports I want to use the function 

training_set = pd.read_json('\Desktop\training_dataset.jsonl')  #edit
print(training_set.head())


to import my dataset. The problem is that what i get is:

ValueError                                Traceback (most recent call last)
&lt;ipython-input-16-f789503c3c7c&gt; in &lt;module&gt;
----&gt; 1 training_set = pd.read_json('\Desktop\training_dataset.json')
      2 print(training_set.head())

~\Anaconda3\lib\site-packages\pandas\io\json\_json.py in 
read_json(path_or_buf, orient, typ, dtype, convert_axes, convert_dates, 
keep_default_dates, numpy, precise_float, date_unit, encoding, lines, 
chunksize, compression)
    590         return json_reader
    591 
--&gt; 592     result = json_reader.read()
    593     if should_close:
    594         try:

~\Anaconda3\lib\site-packages\pandas\io\json\_json.py in read(self)
    715             obj = 
self._get_object_parser(self._combine_lines(data.split("\n")))
    716         else:
--&gt; 717             obj = self._get_object_parser(self.data)
    718         self.close()
    719         return obj

~\Anaconda3\lib\site-packages\pandas\io\json\_json.py in 
_get_object_parser(self, json)
    737         obj = None
    738         if typ == "frame":
 --&gt; 739             obj = FrameParser(json, **kwargs).parse()
    740 
    741         if typ == "series" or obj is None:

~\Anaconda3\lib\site-packages\pandas\io\json\_json.py in parse(self)
    847 
    848         else:
--&gt; 849             self._parse_no_numpy()
    850 
    851         if self.obj is None:

~\Anaconda3\lib\site-packages\pandas\io\json\_json.py in 
_parse_no_numpy(self)
   1091         if orient == "columns":
   1092             self.obj = DataFrame(
-&gt; 1093                 loads(json, precise_float=self.precise_float), 
dtype=None
   1094             )
   1095         elif orient == "split":

ValueError: Expected object or value


and I can't understand why. Can somebody please help me? Thank's in advance.

[EDIT] the file is a .jsonl file, but yet I don't know how to import the dataset because I cannot use .read_json
      ,I have tried this:

openfile=open('Desktop\training_dataset.jsonl')
jsondata=json.load(openfile)
df=pd.DataFrame(jsondata)
openfile.close()
print(df)


but gives me the following error message:

OSError                                   Traceback (most recent call last)
&lt;ipython-input-28-2422c1a9a77b&gt; in &lt;module&gt;
----&gt; 1 openfile=open('Desktop\training_dataset.jsonl')
      2 jsondata=json.load(openfile)
      3 df=pd.DataFrame(jsondata)
      4 openfile.close()
      5 print(df)

OSError: [Errno 22] Invalid argument: 'Desktop\training_dataset.jsonl'


[EDIT 2] by doing as suggested, so:

with open("\Desktop\training_dataset.jsonl") as datafile:
data = json.load(datafile)
dataframe = pd.DataFrame(data)


I again obtain another error message, which is:

OSError                                   Traceback (most recent call last)
&lt;ipython-input-47-1365f26e6db5&gt; in &lt;module&gt;
 ----&gt; 1 with open("\Desktop\training_dataset.jsonl") as datafile:
      2     data = json.load(datafile)
      3 dataframe = pd.DataFrame(data)

OSError: [Errno 22] Invalid argument: '\\Desktop\training_dataset.jsonl'


but I don' understand, because my dataset is placed in my desktop.
You can follow the below steps to load a json file,

First check whether the file is json or not using the following; https://jsonlint.com/. Once you are confirmed the file is a json, use the below code to read it.

with open("training_dataset.json") as datafile:
    data = json.load(datafile)
dataframe = pd.DataFrame(data)


I hope the above will help you.