我想按此顺序创建表,但出现错误

时间:2019-08-21 14:17:58

标签: python-3.x jupyter-notebook jupyter-lab

我使用以下库和代码:

import pandas as pd
import os
import glob2
file_list = glob2.glob("*.txt")

corrected_name_list = []    
for file in file_list:
    corrected_name = file.split(".txt")[0].replace(".","_").replace("-","_") #listede 0 dan saymaya başlayarak bölmelere ayırır ve . ve - yi hata olmaması için çevirir
    vars()[corrected_name] = pd.read_csv(file, sep="\t", header=None, names=["human_id", corrected_name+"_id", corrected_name+"_score"]) #for loop ile dosyaları ekledik (+)arkasından eklenmelein devamını belirtir
    corrected_name_list.append(corrected_name) #append=eklemek, species_name_list species_name' e eklenir
    vars()[corrected_name].set_index("human_id", inplace=True)                 
new = pd.concat([human_longest, GCF_002880755_1_Clint_PTRv2, GCF_003339765_1_Mmul_10, GCF_000151905_2_gorGor4, GCF_000181335_3_Felis_catus_9_0, GCF_000002285_3_CanFam3_1, GCF_000001895_5_Rnor_6_0, GCF_000001635_26_GRCm38_p6, GCF_901000725_2_fTakRub1_2, GCF_000002035_6_GRCz11, GCF_001663975_1_Xenopus_laevis_v2, GCF_000004195_3_Xenopus_tropicalis_v9_1, GCF_000001215_4_Release_6_plus_ISO1_MT, GCF_000224145_3_KH, GCF_000002985_6_WBcel235, GCF_000002765_4_ASM276v2, GCF_000210295_1_ASM21029v1, GCF_000003815_1_Version_2, GCF_000005575_2_AgamP3, GCF_000209225_1_ASM20922v1, GCF_000150275_1_v1_0, GCF_000002865_3_V1_0, GCF_000203795_1_v1_0, GCF_000151265.2_Micromonas_pusilla_CCMP1545_v2.0, GCF_000143455_1_v1_0, GCF_000002425_4_Phypa_V3, GCF_000143415_4_v1_0, GCF_000142945_1_ASM14294v1, GCF_000149755_1_P_sojae_V3_0, GCF_000149405_2_ASM14940v2, GCF_000372725_1_Emiliana_huxleyi_CCMP1516_main_genome_assembly_v1_0, GCF_000165425_1_ASM16542v1, GCF_000189635_1_JCVI_TTA1_2_2, GCF_000006565_2_TGA4, GCF_000004985_1_V1_0, GCF_000002825_2_ASM282v1, GCF_000002725_2_ASM272v2, GCF_000002435_1_GL2, GCF_000002315_6_GRCg6a, GCF_003254395_2_Amel_HAv3_1, GCF_000002235_4_Spur_4_2, GCF_000327385_1_Helro1, GCF_000186865_1_v_1_0, GCF_000146045_2_R64, GCF_000091225_1_ASM9122v1, GCF_001638985_1_Phybl2, GCF_000328475_2_Umaydis521_2_0, GCF_000149245_1_CNA3, GCF_000002945_1_ASM294v2, GCF_000182925_2_NC12, GCF_000002525_2_ASM252v1, GCF_000006445_2_ASM644v2, GCF_000002515_2_ASM251v1, GCF_000002545.3_ASM254v2, GCF_000004695_1_dicty_2_7, GCF_000208925_1_JCVI_ESG2_1_0, GCF_000091205.1_ASM9120v1, GCF_000214015.3_version_140606, GCF_000001735.4_TAIR10.1.txt, GCF_000005425.2_Build_4.0, GCF_000150955.2_ASM15095v2, GCF_000165345.1_ASM16534v1, GCF_000258705.1_Coccomyxa_subellipsoidae_v2.0, GCF_000313135.1_Acastellanii.strNEFF_v1, GCF_000388065.1_Font_alba_ATCC_38817_V2, GCF_000439145.1_ASM43914v3, GCF_001186125.1_Spha_arctica_JP610_V1, GCF_000151315.2_C_owczarzaki_V2, GCF_000002775.4_Pop_tri_v3, GCF_000003225.3_ASM322v1], axis=1, sort=False).reset_index(drop=True)

错误日志如下:

  

文件“”,第7行       new = pd.concat([human_longest,GCF_002880755_1_Clint_PTRv2,GCF_003339765_1_Mmul_10,GCF_000151905_2_gorGor4,   GCF_000181335_3_Felis_catus_9_0,GCF_000002285_3_CanFam3_1,   GCF_000001895_5_Rnor_6_0,GCF_000001635_26_GRCm38_p6,   GCF_901000725_2_fTakRub1_2,GCF_000002035_6_GRCz11,   GCF_001663975_1_Xenopus_laevis_v2,   GCF_000004195_3_Xenopus_tropicalis_v9_1,   GCF_000001215_4_Release_6_plus_ISO1_MT,GCF_000224145_3_KH,   GCF_000002985_6_WBcel235,GCF_000002765_4_ASM276v2,   GCF_000210295_1_ASM21029v1,GCF_000003815_1_Version_2,   GCF_000005575_2_AgamP3,GCF_000209225_1_ASM20922v1,   GCF_000150275_1_v1_0,GCF_000002865_3_V1_0,GCF_000203795_1_v1_0,   GCF_000151265.2_Micromonas_pusilla_CCMP1545_v2.0,   GCF_000143455_1_v1_0,GCF_000002425_4_Phypa_V3,GCF_000143415_4_v1_0,   GCF_000142945_1_ASM14294v1,GCF_000149755_1_P_sojae_V3_0,   GCF_000149405_2_ASM14940v2,   GCF_000372725_1_Emiliana_huxleyi_CCMP1516_main_genome_assembly_v1_0,   GCF_000165425_1_ASM16542v1,GCF_000189635_1_JCVI_TTA1_2_2,   GCF_000006565_2_TGA4,GCF_000004985_1_V1_0,GCF_000002825_2_ASM282v1,   GCF_000002725_2_ASM272v2,GCF_000002435_1_GL2,GCF_000002315_6_GRCg6a,   GCF_003254395_2_Amel_HAv3_1,GCF_000002235_4_Spur_4_2,   GCF_000327385_1_Helro1,GCF_000186865_1_v_1_0,GCF_000146045_2_R64,   GCF_000091225_1_ASM9122v1,GCF_001638985_1_Phybl2,   GCF_000328475_2_Umaydis521_2_0,GCF_000149245_1_CNA3,   GCF_000002945_1_ASM294v2,GCF_000182925_2_NC12,   GCF_000002525_2_ASM252v1,GCF_000006445_2_ASM644v2,   GCF_000002515_2_ASM251v1,GCF_000002545.3_ASM254v2,   GCF_000004695_1_dicty_2_7,GCF_000208925_1_JCVI_ESG2_1_0,   GCF_000091205.1_ASM9120v1,GCF_000214015.3_version_140606,   GCF_000001735.4_TAIR10.1.txt,GCF_000005425.2_Build_4.0,   GCF_000150955.2_ASM15095v2,GCF_000165345.1_ASM16534v1,   GCF_000258705.1_Coccomyxa_subellipsoidae_v2.0,   GCF_000313135.1_Acastellanii.strNEFF_v1,   GCF_000388065.1_Font_alba_ATCC_38817_V2,GCF_000439145.1_ASM43914v3,   GCF_001186125.1_Spha_arctica_JP610_V1,   GCF_000151315.2_C_owczarzaki_V2,GCF_000002775.4_Pop_tri_v3,   GCF_000003225.3_ASM322v1],轴= 1,排序= False)。reset_index(丢弃= True)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ^ SyntaxError:无效令牌

0 个答案:

没有答案