why two \? It is the way that we declare backslash, otherwise, it won't be recognized. If you look at the text in each row (print each row), you would find out that a backslash is at the end of each row, so by replace('\',' ') we are substituting each backslash with nothing(''). Then take a look at arrays to find where the meta data ends and delete the unwanted data (meta data)Īnd then converting the 'arrays' array into the dataframe.ĭf = pd.DataFrame(arrays, columns=arrays) #arrays is the columns names Row = str(row).replace('\\', '') #deleting backslash Path = "C:\\Users\\Souro\\Downloads\\AXISBANK.csv" I think it is better to first import your text in an array or a string and then split it and save into the dataframe specifically when your data is not too large. txt file that is not really written there but is copied when its content is loaded somewhere. The problem might arise because of the meta-text in the. ValueError: could not convert string to float: '"Date"' > 1068 items = ġ070 # Then pack it according to the dtype's nestingĬ:\python3.7.2\lib\site-packages\numpy\lib\npyio.py in (.0)Ĭ:\python3.7.2\lib\site-packages\numpy\lib\npyio.py in floatconv(x) > 1141 for x in read_data(_loadtxt_chunksize):Ĭ:\python3.7.2\lib\site-packages\numpy\lib\npyio.py in read_data(chunk_size)ġ067 # Convert each value according to its column and store > 1 np.loadtxt(r"C:\Users\Souro\Downloads\Data.csv",delimiter=",")Ĭ:\python3.7.2\lib\site-packages\numpy\lib\npyio.py in loadtxt(fname, dtype, comments, delimiter, converters, skiprows, usecols, unpack, ndmin, encoding, max_rows) ValueError Traceback (most recent call last) Np.loadtxt(r"C:\Users\Souro\Downloads\Data.csv",delimiter=",")īut it shows the following error after compiling:. I am trying to load stock market data csv file in a jupyter note book using import numpy as np
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |