data preprosessing
来源:互联网 发布:网络报警中心吧 编辑:程序博客网 时间:2024/05/17 02:16
import pandas as pd
#read the values
newdata = pd.read_csv('annotations_final.csv',sep="\t")
# show the head
newdata.head(5)
#show info
newdata.info()
newdata.columns
#concate two column
newdata[["clip_id","no voice"]]
# Some of the tags in the dataset are really close to each other. Lets merge them togethersynonyms = [['beat', 'beats'], ['chant', 'chanting'], ['choir', 'choral'], ['classical', 'clasical', 'classic'], ['drum', 'drums'], ['electro', 'electronic', 'electronica', 'electric'], ['fast', 'fast beat', 'quick'], ['female', 'female singer', 'female singing', 'female vocals', 'female vocal', 'female voice', 'woman', 'woman singing', 'women'], ['flute', 'flutes'], ['guitar', 'guitars'], ['hard', 'hard rock'], ['harpsichord', 'harpsicord'], ['heavy', 'heavy metal', 'metal'], ['horn', 'horns'], ['india', 'indian'], ['jazz', 'jazzy'], ['male', 'male singer', 'male vocal', 'male vocals', 'male voice', 'man', 'man singing', 'men'], ['no beat', 'no drums'], ['no singer', 'no singing', 'no vocal','no vocals', 'no voice', 'no voices', 'instrumental'], ['opera', 'operatic'], ['orchestra', 'orchestral'], ['quiet', 'silence'], ['singer', 'singing'], ['space', 'spacey'], ['string', 'strings'], ['synth', 'synthesizer'], ['violin', 'violins'], ['vocal', 'vocals', 'voice', 'voices'], ['strange', 'weird']]
# Merge the synonyms and drop all other columns than the first one."""Example:Merge 'beat', 'beats' and save it to 'beat'.Merge 'classical', 'clasical', 'classic' and save it to 'classical'."""for synonym_list in synonyms: newdata[synonym_list[0]] = newdata[synonym_list].max(axis=1) newdata.drop(synonym_list[1:], axis=1, inplace=True)
# Lets view it.newdata.head()
阅读全文
0 0
- data preprosessing
- data
- data ()
- data
- Data
- data
- data
- data
- data
- data
- <data>
- data
- DATA
- data
- data
- data
- data
- @Data
- 报错信息:java.io.FileNotFoundException拒绝访问
- AngularJS构建单页面应用WebApp目录介绍
- Maximum Width of Binary Tree
- C++ STL中Map的按Key排序和按Value排序
- C# 简单文件备份工具(简便打开复制粘贴)(发布版)
- data preprosessing
- 建立微积分教育普及网站为何势在必行?
- phpstorm使用手册
- 旋转数组的二分查找
- FTPrep, 58 Length of last word
- 说出数据连接池的工作机制是什么
- JDBC常用的接口
- classforName
- Java数据对象(JDO)的前世今生