python - Reading a sqlite3.Binary object with numpy.genfromtxt -
I have a text file that contains a large string that was originally a binary blob in the SQL column. I would like to read the data using the numpy.genfromtxt
and convert the text to the 1d NMP array and then using the converters parameter in a binary blob to import into SQL later:
np.genfromtxt (data, delimiter = '\ t', dtype = [("a", 'f8'), ("b", 'u100'), ("c" , 'F8')], converters = {1: Lambda X: SQLite 3. Binary (NP.frosting (X, DTP = 'F4', SP = ''))}
< P> and import file will be Something like this: 1.0 \ t1.0 2.0 3.0 \ t1.0
However this error message returns:
file "./ Import_sql .py ", line 25, & lt; Module & gt; Converters = {19: Lambda X: Esquite 3 Binary (file "/usr/lib/python3.4/site-packages/numpy/lib/npyio.py", line 1742, in Geneofomtext rows = NP.Ere (data, DTP = [for Dtype_flat _} [[ Value error: an array element can not be set with a sequence
I would like to return a array of genfromtxt where the first and third column float values will be included and the second The column will have sqlite3. The data of the binary blob with 1D NMP array.
This does not work because I It is possible to read the data from mass StormText in a large string in the output and then before writing the data to the process database. Is it possible to include a sequel 3. Binary Object in a NMP array?
You can only type from the column type b
to 'U100'
to the object
Switch, then it should work.
Comments
Post a Comment