Currently, I am trying to read csv in Python's pandas to learn.
So if you run it
ValueError: could not convert srtrring to float' v-0.6703230.0173202.448769\nv-0.2484260.0668552.655411\nv-0.634120.1595612.476978'
It appears and cannot be executed.
For x, we specify a column of csv, and for y, we convert the image data of the 3D array into a 2D array and put it in.
d_data_set=pd.read_csv("tes.csv", encoding="utf-8", dtype="object")
search_dir='./image'
f=np.array ([data.imread('{}/{}'.format(search_dir, path)) for path inos.listdir(search_dir))])
f=f.reshape(len(f), -1).astype(np.float64)
x = f
y = df [:, "don" ]
I will write the contents of csv below.
This csv has 800 cells except for the header that says don in the first line, and each cell has a new line with a space between each number and three lines, such as the following:
don
"v 0.3105270.0152960.505581
v0.683512-0.0015980.216188
v 0.3708060.1492910.478181"
"v 0.313408 0.008205 0.505414
v0.685073-0.0061960.214194
v 0.3739340.1423580.479367"
"v0.3045310.0040020.505210
v0.680174-0.0089610.219070
v 0.3659130.1381710.481338"
"v 0.297987-0.0060710.504920
v0.676619-0.0102230.222481
v 0.3579030.1291840.483590"
"v 0.305034-0.0110750.504809
v0.680596-0.010772 0.218271
v 0.4680770.1248640.479119"
Displays 5 cells of data except the first don because it is too long.
I would like to learn 800 cells except for the first don as deep learning data for 800 units.
I look forward to hearing from you.
I will write my execution environment below
Windows 10
pycharm
python 3.5
After checking the environment code below, I was able to load the csv file without any problems.
load-csv.py
import pandas as pd
d_data_set=pd.read_csv("tes.csv", encoding="utf-8", dtype="object")
tes.csv
"v 0.3105270.0152960.505581
v0.683512-0.0015980.216188
v 0.3708060.1492910.478181"
"v 0.313408 0.008205 0.505414
v0.685073-0.0061960.214194
v 0.3739340.1423580.479367"
"v0.3045310.0040020.505210
v0.680174-0.0089610.219070
v 0.3659130.1381710.481338"
"v 0.297987-0.0060710.504920
v0.676619-0.0102230.222481
v 0.3579030.1291840.483590"
"v 0.305034-0.0110750.504809
v0.680596-0.010772 0.218271
v 0.4680770.1248640.479119"
I haven't been able to confirm it in the same environment, so I can't say anything about it, but
Why don't you use the delimiter option in the read_csv
function of the pandas to specify a delimiter character?
ref: pandas.read_csv —pandas 0.23.4 documentation
© 2024 OneMinuteCode. All rights reserved.