ITADN

can not add new row attribute

#184Closedwt12318 创建于 2024-03-17
W
wt12318commented
Hi, I want to add new row attribute: ``` tt = loompy.connect("/root/autodl-tmp/pcd_dataset/pcd_obj.loom") tt.ra.keys() ##['Gene'] tt.ra.ensembl_id = tt.ra.Gene.tolist() ``` ![图片](https://github.com/linnarsson-lab/loompy/assets/39486023/ec7289c7-f04c-4f65-8f80-525b87ee3885) But I got some error: ``` --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Cell In[63], line 1 ----> 1 tt.ra.ensembl_id = tt.ra.Gene.tolist() File ~/miniconda3/envs/geneformer/lib/python3.10/site-packages/loompy/attribute_manager.py:149, in AttributeManager.__setattr__(self, name, val) 147 else: 148 if self.ds is not None: --> 149 values = loompy.normalize_attr_values(val, compare_loom_spec_version(self.ds._file, "3.0.0") >= 0) 150 a = ["/row_attrs/", "/col_attrs/"][self.axis] 151 if self.ds.shape[self.axis] != 0 and values.shape[0] != self.ds.shape[self.axis]: File ~/miniconda3/envs/geneformer/lib/python3.10/site-packages/loompy/utils.py:27, in compare_loom_spec_version(f, v) 26 def compare_loom_spec_version(f: HDF5File, v: str) -> int: ---> 27 vf = int("".join(get_loom_spec_version(f).split("."))) 28 vc = int("".join(v.split("."))) 29 if vf == vc: AttributeError: 'numpy.ndarray' object has no attribute 'split' ``` How to fix it? Thank you.
关闭于 2024-11-13 1 条评论