![](https://img-blog.csdnimg.cn/20200619155201630.jpeg?x-oss-process=image/resize,m_fixed,h_224,w_224)
python
对python的理解,由浅入深记录
心心念念的小鼠标
为梦想而疯狂!
展开
-
Python数据分析(一)-Pandas「2」
切片操作# 从第十行到二十行的所有值,间隔为2.s4=college[10:20:2]print(s4)结果:在College中,第十行到第二十行的截图展示,可以对比看打印结果。# 获取具体某个列的具体信息seriesapps=college['Apps']# 对某一列进行切片处理,获取想要的值seriesapps[1:10:2]//输出结果1 21863 4175 5877 18999 582Name: Apps, dtype:原创 2020-07-06 18:00:45 · 251 阅读 · 0 评论 -
Python数据分析(一)-Pandas「1」
Pandas是什么?Pandas是一个强大的分析结构化数据的工具集;它的使用基础是Numpy(提供高性能的矩阵运算);用于数据挖掘和数据分析,同时也提供数据清洗功能Pandas利器DataFrameDataFrame是Pandas中的一个表格型的数据结构,包含有一组有序的列,每列可以是不同的值类型(数值、字符串、布尔型等),DataFrame即有行索引也有列索引,可以被看做是由Series组成的字典。对DataFrame最直接的理解就是它是一个Excel文件。Series它是一种类似于一维数原创 2020-07-01 17:59:48 · 762 阅读 · 0 评论 -
python基础实战(七)-Exception
本篇则主要了解几个常见的Exception。ZeroDivisionError除数等于0的报错方式num=1/0num结果:ZeroDivisionError Traceback (most recent call last)<ipython-input-3-137c35d0a8b8> in <module>----> 1 num=1/0 2 numZeroDivisionError: divis原创 2020-06-29 17:33:23 · 204 阅读 · 0 评论 -
puython基础实战(六)-List Comprehensions
List Comprehensions中文翻译应该就是一种列表推导的意思,那最终的功能还是生成list,其实就是一种简化代码的方式。比如我们要create a number list from 0 to 9.最普通的创建方式:# 创建一个空集合num_list=[]# for循环分别赋值for i in range(0,10): num_list.append(i)num_list//输出结果[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]但是除了这种方式,我们还原创 2020-06-29 11:35:00 · 287 阅读 · 0 评论 -
python基础实战(五)-dictionary,set
python中常用的Contailer Types(类型)有四个:ListTupleDictionaryA dictionary is similar to a list, but the order of items doesn’t matter and they aren’t selected by their offset (index). Instead, you specify a unique key to associate with each value. The key is o原创 2020-06-23 17:51:30 · 371 阅读 · 0 评论 -
puthon基础实战(四)-Tuple
python中常用的Contailer Types(类型)有四个:ListTupleSimilar to lists, tuples are also sequences of arbitrary items. However, tuples are immutable. You can not add, detele or change it after it is defined.DictionarySet上篇博客对list了解了一下,本篇则对Tuple学习一下。List是可以对其进行增原创 2020-06-23 14:30:20 · 614 阅读 · 0 评论 -
python基础实践(三)-list
python中常用的Contailer Types(类型)有四个:ListString is a sequence of characters, list is a sequece of object. Use list when the order of objects matters a lot.(有序要求用list)TupleDictionarySetNested list(嵌套列表)对list的一些基本操作dal_memeber= [['huohuo',18],['huhu',1原创 2020-06-23 14:04:04 · 184 阅读 · 0 评论 -
python基础实战(二)-str
字符串#python2的写法print('%s %s' % ('one','two'))print('{} {}'.format('one','two'))#python2的写法,%d format: a number is required, not str,只能接收数字print('%d %d' % (1,2))# python3的写法print('{} {}'.format(1,2))#可以调换输入顺序print('{1} {0}'.format('one','two'))//输原创 2020-06-22 11:33:28 · 159 阅读 · 0 评论 -
python基础实战(一)-input,math,type
demo:输入一个数,这个数代表从凌晨0点开始计算的分钟数,并计算并输出当前时间例如:如果输入的是150,那么应该就是凌晨2:30,所以程序输出也是2:30passed_min=int(input("已经过了多少分钟"))hours=passed_min//60passed_min= passed_min % 60print("那么现在是 ",hours, ":",passed_min)输出结果://input 数值是自己随便输入的。已经过了多少分钟200那么现在是 3 : 20原创 2020-06-22 10:09:47 · 679 阅读 · 0 评论