2019年9月5日

一列分成多行的情况

摘要: data=pd.DataFrame({'v_id':['d1','d2'], 'pred_class':['cat,dog','other_label,fish'], 'pred':[[0.72,0.65],[0.11,0.23]], 'id_part':['d',5],}) data=pd.Dat 阅读全文

posted @ 2019-09-05 08:42 离云1 阅读(346) 评论(0) 推荐(0) 编辑

2019年9月3日

datetime,time函数的参数有哪些

摘要: time.strftime里面有很多参数,可以让你能够更随意的输出自己想要的东西:下面是time.strftime的参数:strftime(format[, tuple]) -> string将指定的struct_time(默认为当前时间),根据指定的格式化字符串输出python中时间日期格式化符号 阅读全文

posted @ 2019-09-03 08:35 离云1 阅读(662) 评论(0) 推荐(0) 编辑

2019年8月22日

np.newaxis

摘要: np.newaxis的作用就是在这一位置增加一个一维,这一位置指的是np.newaxis所在的位置,比较抽象. In[65]:l=np.arange(10) l Out[65]: array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) In[65]:l=np.arange(10) 阅读全文

posted @ 2019-08-22 08:39 离云1 阅读(204) 评论(0) 推荐(0) 编辑

2019年8月19日

df.were(),df.mask()

摘要: df.where(cond,other...) df.mask() df.where将series中不满足cond的那些值替换为other df.mask()结果与where()相反 df.where(cond,other...) df.mask() df.where将series中不满足cond的 阅读全文

posted @ 2019-08-19 08:22 离云1 阅读(583) 评论(0) 推荐(0) 编辑

2019年8月2日

pd.MultiIndex()多层次索引

摘要: In[38]:import pandas as pd m_index1=pd.MultiIndex(levels=[['A','B'],['x1','x2']],labels=[[0,1],[0,1]],name=[None,"class2"]) m_index1 Out[38]: MultiInd 阅读全文

posted @ 2019-08-02 08:54 离云1 阅读(3247) 评论(0) 推荐(0) 编辑

pd.wide_to_long()

摘要: pd.wide_to_long() pd.wide_to_long(df,stubnames(提取以指定字符串开头的列),i(用作索引的列),j(提取开头后剩余的部分会成一列,在此指定列名),sep(分隔符),suffix(捕获正则表达式匹配的后缀)) pd.wide_to_long() pd.wi 阅读全文

posted @ 2019-08-02 08:29 离云1 阅读(962) 评论(0) 推荐(0) 编辑

2019年7月31日

df.melt() df.pivot()

摘要: df.melt(),df.pivot() 互为逆转函数 df.melt(),df.pivot() 互为逆转函数 df.melt(),df.pivot() 互为逆转函数 df.melt(),df.pivot() 互为逆转函数 In [23]: df=pd.DataFrame({'A':['a','b' 阅读全文

posted @ 2019-07-31 08:46 离云1 阅读(940) 评论(0) 推荐(0) 编辑

2019年7月30日

根据数据类型选择特征 select_dtypes(include=[]/exclude=[])

摘要: 根据数据类型选择特征 select_dtypes(include=['']/exclude=[]) 根据数据类型选择特征 select_dtypes(include=['']/exclude=[]) 根据数据类型选择特征 select_dtypes(include=['']/exclude=[]) 阅读全文

posted @ 2019-07-30 08:35 离云1 阅读(2994) 评论(0) 推荐(0) 编辑

2019年7月29日

quantile()

摘要: quantile() 确定四分位数的位置有两种方法, 方法1 pos = (n+1)p 方法2 pos = 1+(n-1)p pandas 中使用的是方法2确定的。默认使用linear插值 quantile() 确定四分位数的位置有两种方法, 方法1 pos = (n+1)p 方法2 pos = 1 阅读全文

posted @ 2019-07-29 08:24 离云1 阅读(507) 评论(0) 推荐(0) 编辑

concat()、merge()的区别

摘要: concat,merge的区别 concat,merge的区别 concat,merge的区别 concat,merge的区别 In [154]: data1=pd.DataFrame(np.arange(6).reshape(2,3),columns=list('abc')) data2=pd.D 阅读全文

posted @ 2019-07-29 08:23 离云1 阅读(1893) 评论(0) 推荐(0) 编辑

导航