- 博客(12)
- 收藏
- 关注
原创 Python Data Representation学习笔记【Week4】:Project: Analyzing Baseball Data
凌晨1:43终于调试完毕啦~这个作业有点小复杂,数据存储有点混乱所以搞了半天qaq核心是所有的东西都要从info这个字典里取到。先从info里取到fieldname,然后在用fieldname去读取大字典里的其他内容。大字典也要通过先从info取csv文件,再读取成大字典。。用到了一个三重for循环那里暂时没有想到好的方案,明天再来看看能不能优化(这个时候无比思念sql啊啊啊)"...
2019-05-13 01:47:39 589 1
原创 Python Data Representation学习笔记【Week3 Exercise】:Project: Reading and Writing CSV Files
第一次上传只有5分..因为貌似OwlTest的评分要求是需要用orderedDict的~所以需要用到collections.OrderedDict()来创建字典~"""Project for Week 3 of "Python Data Analysis".Read and write CSV files using a dictionary of dictionaries.Be...
2019-05-12 23:04:48 474
原创 Python Data Analysis学习笔记【Week4】——Organizing Data
一、使用python内置函数进行排序1.使用sort()函数对list进行排序import random# Easily create a list of numbersdata = list(range(10))print("range data:", data)# Randomly shuffle those numbersrandom.shuffle(data)pr...
2019-05-12 23:00:06 175
原创 Python Data Analysis学习笔记【Week3】——Python CSV module
一、使用csv模块将csv文件保存在嵌套list中"""Using the csv module."""import csvdef parse(csvfilename): """ Reads CSV file named csvfilename, parses it's content and returns the data within the...
2019-04-27 18:47:24 244
原创 Python Data Analysis学习笔记【Week2】——Tabular Data and Nested Data Structures
一、Tabular DataTabular Data是二维数据,包括rows和columns。阅读材料链接:https://www.coursera.org/learn/python-analysis/supplement/h6zif/tabular-data二、使用嵌套的list在Python中储存Tabular Data1.打印用嵌套的list存储的tabular dat...
2019-04-04 11:41:19 517
原创 Python Data Analysis学习笔记【Week1】——Python Dictionaries
一、Dictionary简介Dictionary是Python中的一种数据结构,能够映射key和value。例:key value 1------>2 2------>3 4------>3-Dictionary中的value可以是任何数据结构,可以是数值,string,list等。-但Diction中的key必须是immutable的...
2019-04-02 20:53:19 136 2
原创 Python Data Representation Final Project: File Differences
Project: File Differences啊~终于调试到满分了~测试了整整7次~"""Project for Week 4 of "Python Data Representations".Find differences in file contents.Be sure to read the project description page for further ...
2019-03-31 00:30:14 439
原创 Python Data Representation 【Week 4 Exercise】:Practice Project: Updating the CodeSkulptor Docs
Practice Project: Updating the CodeSkulptor Docsdebug了好久的我实在是太菜了.."""Week 4 practice project template for Python Data RepresentationUpdate syntax for print in CodeSkulptor Docsfrom "print ..."...
2019-03-30 18:30:34 243
原创 Python Data Representation学习笔记【Week4】——Python Files
一、Files的四种基本操作:open, read, write, close1.Python打开文件的open()函数-两个参数。open(文件名:String,打开方式:String) ,例:# Open takes a filename and a modeopenfile = open("the_idiot.txt", "rt")print(type(openfile)...
2019-03-29 23:28:21 226
原创 Python Data Representation学习笔记【Week3】——Python List Manipulation
一、改变List的内容1.改变list中的某个item的值。用index指定需要改的元素,直接赋新值。lst = list(range(5))print(lst)lst[1] = -7lst[3] = 17print(lst)输出结果为:2.给list增加新的item-用append()函数在list末尾增加一个itemlst.append(42)pri...
2019-03-28 18:08:02 236 3
原创 Python Data Representation学习笔记【Week2】——Python Lists
一、创建一个List1.直接用[]的形式创建一个list,list可以为空,也可以为数值、字符串等。P.S.List没有数据类型限制,将不同的数据类型混合组成一个list仍然可以正常执行程序,但不建议这样做。在List中存放相同数据类型的数据会更容易处理,且不容易出错。print("List Literals")print("=============")# List lite...
2019-03-26 14:44:51 444 2
原创 Python Data Representation学习笔记【Week1】——Python Strings
一、String的表示方法1.声明一个String可以用" "或者' ',两者没有差别,为了方便使用,可以在字符串内容中含有 ' 时用" ",同理也可以在含有 " 时用' ',避免使用转义字符。# Strings are enclosed in quotesname = 'Scott Rixner'university = "Rice"print(name)print(un...
2019-03-25 16:22:56 160 3
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人