python - Pandas pd.read_csv - has anything changed? -


i have piece of code wrote jupyter ~1 year ago used

 dg = pd.read_csv(f10,sep=';') 

to read data

a;w 83;88,0 64;70,1 94;94,2 

today get:

oserror: initializing file failed 

and somewhere inbetween:

c:\anaconda3\lib\site-packages\pandas\io\parsers.py in _make_engine(self, engine)     964     def _make_engine(self, engine='c'):     965         if engine == 'c': --> 966             self._engine = cparserwrapper(self.f, **self.options)     967         else:     968             if engine == 'python': 

this, however, works today:

with open(f10, newline='') csvfile:     data = csv.reader(csvfile, delimiter=';') 

since prefere pandas-way, has idea should change ? tx hints !

edit : i've found out, works too:

with open(f10, newline='') csvfile:     dg = pd.read_csv(csvfile, delimiter=';') 

but necessary ?

i guess problem comes newline expected \n pandas.

you can pass buffer directly pd.read_csv():

dg = pd.read_csv(open(f10, newline=''), sep=';') 

Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -