简体   繁体   中英

How To Solve KeyError: “None of [Index([..], dtype='object')] are in the [columns]”/KeyError(f"None of [{key}] are in the [{axis_name}]")

I'm a student trying to replicate the results of a paper for my class. I'm having trouble rerunning the source code and it returns this error. I'm very new to all these modules and not quite sure how to fix this even after reading this thread. I'm trying to run the spatial_SeqFISH_analysis.py (in Analysis/SeqFish/) and it returns this error:

Traceback (most recent call last):

  File "spatial_SeqFISH_analysis.py", line 41, in <module>

    results = main()

  File "spatial_SeqFISH_analysis.py", line 15, in main

    df = df[sample_info.index]

  File "/home/lu003/.local/lib/python3.8/site-packages/pandas/core/frame.py", line 3030, in __getitem__
    indexer = self.loc._get_listlike_indexer(key, axis=1, raise_missing=True)[1]

  File "/home/lu003/.local/lib/python3.8/site-packages/pandas/core/indexing.py", line 1266, in _get_listlike_indexer

    self._validate_read_indexer(keyarr, indexer, axis, raise_missing=raise_missing)

  File "/home/lu003/.local/lib/python3.8/site-packages/pandas/core/indexing.py", line 1308, in _validate_read_indexer

    raise KeyError(f"None of [{key}] are in the [{axis_name}]")

KeyError: 

"None of [Index(['oid sha256:8f40e082985198819ac5a55129272c64d4cf047cc688313b911ead6df82ebae4', 'size 6038'], dtype='object', name='version https://git-lfs.github.com/spec/v1')] are in the [columns]"

My inputs: I ran their shell script rerun_all.sh and that runs all the analysis py files. In spatial_SeqFISH_analysis.py df and sample_info is used like so:

#pd is pandas

df = pd.read_csv('exp_mat_43.csv', index_col=0) 
df.columns = df.columns.map(int)

# Get coordinates for each sample
sample_info = pd.read_csv('sample_info_43.csv', index_col=0)

df = df[sample_info.index]

X = sample_info[['x', 'y']]

The csv files holds pointers I think to Git LFS. Example this is sample_info.csv:

version git-lfs.github.com/spec/v1 
oid sha256:a6229820d917eab59582652a5f8ffcf8fa5ed124477ae2dd1046834f6bb5062d 
size 164964

If anybody could be of help that would be great!

The article link: https://www.nature.com/articles/nmeth.4636 Github source code: https://github.com/Teichlab/SpatialDE

I think I know the problem. Since I didn't install git-lfs beforehand, the csv files were left as pointers to the storage. However, sadly after re-cloning the repo, the lfs files were too large and I still couldn't run the code.

This is what it returned after cloning:

 This repository is over its data quota. Account responsible for LFS bandwidth should purchase more data packs to restore access.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM