带你一起盘点,Pandas1.0的主要功能
>>> C = pd.Series([False, True, False], dtype="bool") >>> df.B = B, df.C = C >>> df.info() <class 'pandas.core.frame.DataFrame'> RangeIndex: 3 entries, 0 to 2 Data columns (total 3 columns): # Column Non-Null Count Dtype --- ------ -------------- ----- 0 A 3 non-null int64 1 B 3 non-null string 2 C 3 non-null bool dtypes: int64(1), object(1), string(1) memory usage: 200.0+ bytes 注意Dtype列现在如何反应新类型的string和bool。 新字符串dtype最实用的优势在于,可以从DataFrame中选择string列。这样可以更快地仅对数据集的文本成分进行分析。 df.select_dtypes("string") 以前,只能通过显式使用其名称来选择string类型列。 从今天开始,掌握Pandas 1.0的主要功能,全新优化开启使用吧~ (编辑:威海站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |