我是靠谱客的博主 追寻航空,这篇文章主要介绍python 去掉只出现一次的类别,现在分享给大家,希望可以做个参考。

 	fileName = file_name
    csvfile = open(fileName , 'rb')  # 打开csv文件
    reader = pd.read_csv(csvfile)  # 读取文件内容
    # print(reader['label'].value_counts())
    aps = reader['label'].value_counts()
    one = (aps== 1)  ###
    # print(aps[one])
    reader = reader[(~reader['label'].isin(list(aps[one].index)))]
    # print(reader['U_CODE'].value_counts())
    reader.to_csv(outputFile,index=0)

最后

以上就是追寻航空最近收集整理的关于python 去掉只出现一次的类别的全部内容,更多相关python内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(124)

评论列表共有 0 条评论

立即
投稿
返回
顶部