for ix in xrange(len(self.row_attr_names)):
row_types[self.row_attr_names[ix]] = "float64" if np.issubdtype(self.row_attr_values[ix].dtype, np.number) else "string"
to:
for ix in xrange(len(self.row_attr_names)):
row_types[self.row_attr_names[ix]] = "float64" if np.issubdtype(np.array(self.row_attr_values[ix]).dtype, np.number) else "string"
but I get another error this time:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-3-3bc46a868eb4> in <module>()
----> 1 loompy.create_from_cef('Yiwen/Yiwen_clustering_v2.cef', 'Yiwen/Yiwen_clustering_v2.loom')
/Users/admin/anaconda/lib/python2.7/site-packages/loompy/loompy.py in create_from_cef(cef_file, loom_file)
104 cef = _CEF()
105 cef.readCEF(cef_file)
--> 106 cef.export_as_loom(loom_file)
107
108 def create_from_pandas(df, loom_file):
/Users/admin/anaconda/lib/python2.7/site-packages/loompy/loompy.py in export_as_loom(self, filename)
1291 col_types[self.col_attr_names[ix]] = "float64" if np.issubdtype(np.array(self.col_attr_values[ix]).dtype, np.number) else "string"
1292
-> 1293 create(filename, self.matrix, dict(zip(self.row_attr_names, self.row_attr_values)), dict(zip(self.col_attr_names, self.col_attr_values)), row_types, col_types)
1294
1295 def add_header(self, name, value):
/Users/admin/anaconda/lib/python2.7/site-packages/loompy/loompy.py in create(filename, matrix, row_attrs, col_attrs, row_attr_types, col_attr_types)
80 if not row_attr_types.has_key(key):
81 raise ValueError, "Type information missing for row attribute " + key
---> 82 ds.set_attr(key, vals, axis = 0, dtype=row_attr_types[key])
83
84 for key, vals in col_attrs.iteritems():
/Users/admin/anaconda/lib/python2.7/site-packages/loompy/loompy.py in set_attr(self, name, values, axis, dtype)
571 raise TypeError, "Data type must be provided"
572
--> 573 values = values.astype(dtype)
574
575 if dtype != "int" and dtype != "float64" and dtype != "string":
AttributeError: 'list' object has no attribute 'astype'
Probably the error is still becouse array is expected instead of lists
This code throws an error:
loompy.create_from_cef('Yiwen/Yiwen_clustering_v2.cef', 'Yiwen/Yiwen_clustering_v2.loom')
I tried to solve by changing:
to:
but I get another error this time:
Probably the error is still becouse array is expected instead of lists