Python
我是一只小小小菜鸟
一个小菜鸟的学习史上遇到的问题总结。
展开
-
python %s and %r and %d 区别
#--coding:utf-8--#test %s and %r and %dx="I want to test this"y=3print "this is the test 1:%s"%xprint "this is the test 2:%r"%xprint "this id the test 3:%d"%y原创 2016-05-04 16:01:40 · 1305 阅读 · 0 评论 -
在print 时,的作用
print语句默认的会在后面加上 换行 加了逗号之后 换行 就变成了 空格print abc,print aprint abcprint a结果:abcaabca原创 2016-05-04 17:03:48 · 643 阅读 · 0 评论 -
pypython import
用import或者from...import来导入相应的模块转载 2016-08-19 16:16:43 · 521 阅读 · 0 评论 -
Python中input和raw_input的一点区别
使用input和raw_input都可以读取控制台的输入,但是input和raw_input在处理数字时是有区别的当输入为纯数字时:input返回的是数值类型,如int,floatraw_inpout返回的是字符串类型,string类型输入字符串为表达式input会计算在字符串中的数字表达式,而raw_input不会。如输入“57 + 3”:input会得到整数60转载 2016-08-11 18:01:21 · 332 阅读 · 0 评论 -
Python 中pandas 中cut方法
在对数据进行分段分组时,可采用cut方法,用bins的方式实现。这种情况一般使用于,对于年龄、分数等数据。import randomimport pandas as pdimport numpy as npfrom pandas import Series,DataFrame#用随机数产生一个二维数组。分别是年龄的性别。df=pd.DataFrame({'Age':np.rando...原创 2019-09-28 12:06:54 · 23462 阅读 · 4 评论