摘要:
''' 转换数据 ''' import pandas as pd df = pd.DataFrame([ ['green', 'M', '10.2', 'class1'], ['red', 'L', '13.5', 'class2'], ['blue', 'XL', '15.3', 'class1'], ]) df.columns = ['color 阅读全文
摘要:
''' 数据的清洗 1.检测与处理重复值 2.检测与处理缺失值 3.检测与处理异常值 ''' import numpy as np import pandas as pd # 去重:按照A列去重,同时保留第一个数据且在原表去重 data = pd.DataFrame({'A': [1, 1, 2, 2], 'B':... 阅读全文
摘要:
import numpy as np import pandas as pd df1 = pd.DataFrame(np.ones((3, 4)) * 0, columns=['a', 'b', 'c', 'd']) df2 = pd.DataFrame(np.ones((3, 4)) * 1, columns=['a', 'b', 'c', 'd']) df3 = pd.DataFrame(... 阅读全文