讲解:IEEE、Python、Python、DataFramePython|Web

Description Type NameCover sheet Compulsory One PDF (.pdf) file Student_number.pdfYour solution to question 1 Compulsory One Python (.py) file Q1.pyYour solution to question 2 Compulsory One Python (.py) file Q2.pyYour solution to question 3 Compulsory One Python (.py) file Q3.pyFor question 1 and 2 submission follow below instructions:Download the following files from Learning Central:• Q1.py• Q2.pyReplace ‘Student_number’ by your student number, e.g. C1234567890. Make sure to includeyour student number as a comment in all of the Python files!Submission InstructionsYour coursework should be submitted via Learning Central by the above deadline. You haveto upload the following files:• Q3.py• IEEEexample.docx• APAexample.docx• nobelprizes.json• whitelist.txtTest your implementation:For Q1 and Q2, you can execute the function from the command line> python3 Q1.py> python3 Q2.pyYou can change the parameters of the function call in the main part of Q1.py and Q2.py.For Q3, you can use> python3 Q3.py my_paper.docx IEEEwhere my_paper.docx is an example journal paper and IEEE represents the target style.Any deviation from the submission instructions above (including the number and types offiles submitted) will result in a mark of zero for the assessment or question part.Staff reserve the right to invite students to a meeting to discuss coursework submissionsAssignmentAnswer all of the following questions.Question 1 – Random converterImplement a function random_converter(x) that takes a variable x. It then returns the valueof x that has been randomly converted into int, float, bool, string or complex.For instance, for x = 12 (an integer) random_converter(x) can return ’12’ (a string) or 12.0(a float).Further instructions:• x can be any type in int, float, bool, string or complex.• the assignment needs to be truly random, that is, if repeated several times, differentoutcomes should result.• If x cannot be converted (e.g. the string “house” cannot be converted to a number) thefunction should print “cannot be converted” and return none.As a starting point, use Q1.py from Learning Central. Do not rename the file or the function.Question 2.1 - Implement a function report(), which takes as input the json file loaded as a Pythondictionary (which is the default data structure returned by the json.load() method). Thisfunction should return a Pandas DataFrame, where you include the years and categories inwhich a Nobel Prize was awarded and those in which it was not. You are not expected toinfer any missing information, you should only include years and categories for which thereis an explicit entry in the original dataset. The result should be of the following form (madeup values):year category awarded_or_not1963 chemistry True1976 physics FalseFurther instructions:• There is no field called ‘awarded_or_not’ in the dataset, you have to find thisinformation elsewhere. Discuss your solution in the code as comments.• Years should be represented as integers, categories as strings and awarded_or_notvalues should be boolean.• Column names should be ‘year’, ‘category’ and ‘awarded_or_not’.Question 2.2 - Write a function get_laureates_and_motivation() which takes as input threearguments: the nobel prize dictionary (same as in Q2.1), year (a string) and category (astring). This function returns a Pandas DataFrame containing one row per laureate (i.e., aperson who has won the Nobel prize). The returned DataFrame should be of the form below(made up values):category year id laureate motivation overall_motivationchemistry 1963 501 john doe he was great he was amonggreat mindschemistry 1963 700 susan sarandon she was great NaNFurther instructions:• The id values refer to the laureate id as per their identifier in the original dataset.• Overall motivations are reasons for awarding Nobel prizes which apply to more thanone person in the same batch. However, not all laureates have an overall motivationassociated. In those cases, you should insert a NaN value in their ‘overall_motivation’field.• Categories, laureates and motivation should be strings, years and ids should beintegers, and overall_motivation should be either string or NaN.Question 2 – Nobel Prize Data MiningYou are provided with a dataset in json format (nobelprizes.json), which contains informationabout Nobel prize winners. Specifically, you will find information about a winner’s name,category, reason for award, year, etc. To load the dataset, you will need to use the jsonmodule (import json), and the d = json.load(file_object) method.• Use the column names shown in the sample table above, do not change them.Question 2.3 - Write a function plot_freqs() which generates six plots, one for each category. The xaxisshould contain the 1st, 10th, 20th, 30th, 40th and 50th most frequent word across themotivation sections for each category. The y-axis should refer to the frequency of each wordin that category. The resulting plot should have a similar arrangement as the one below.Further instructions.• You should only count the words provided in whitelist.txt, a text file available inlearning central, with one word per line. Do not count others.• Your figures should have a title, legend, the frequency of each word, tick marks, labelsin the x axis for each word, be readable (e.g., big enough fonts), etc.As a starting point, use Q2.py from Learning Central. Do not rename the file or the functions.Question 3 – Citation Style ManagerIn scientific publications, a reference to a previous work (source) that is discussed in themanuscript is called a citation. In different scientific disciplines, and sometimes evendifferent journals, different so-called citation styles are used. The citation style defines how acitation is formatted. We will consider two different citation styles in this question:- APA style: citation style of the American Psychological Association(https://www.mendeley.com/guides/apa-citation-guide), see also Wikipedia page(https://en.wikipedia.org/wiki/APA_style). This style is widely used in Psychologyand Social Sciences.- IEEE: citation style of the Institute for Electrical and Electronics Engineers (IEEE) isused in IEEE journals which cover engineering and related disciplines(https://pitt.libguides.com/citationhelp/ieee). See the Learning Materials/Courseworkfolder on Learning Central for more information on the IEEE style.There are two main aspects to a publication where citation styles apply:1. In-text citations: These are used in the text body whenever one refers to, summarises,paraphrases, or quotes from another source. This is an example from Wikipedia(https://en.wikipedia.org/wiki/APA_style) for a sentence including an in-text citationof a paper by Schmidt and Oh in APA format:In our postfactual era, many members of the public fear that the findings ofscience are not real (Schmidt & Oh, 2016).In IEEE format, references are given as numbers in square brackets. Example:This is compounded by the fact that the field is evolving from work performedby an individual that does data science to a t代写IEEE、代做Python语言、Python编程设计调试eam that does data science [1].2. Reference list: In a scientific publication, the last section is typically the Referencessection, which provides full details on the in-text citations. For instance, the fullreference corresponding to the Schmidt & Oh (2016) in-text citation above would be:Schmidt, F. L., & Oh, I.-S. (2016). The crisis of confidence in researchfindings in psychology: Is lack of replication the real problem? Or is itsomething else? Archives of Scientific Psychology, 4(1), 32–37.https://doi.org/10.1037/arc0000029In an article using IEEE format, every reference in the reference list needs to benumbered:1. J. Saltz, The Need for New Processes Methodologies and Tools to SupportBig Data Teams and Improve Big Data Project Effectiveness, Big DataConference, 2015.Your task: Implement a function change_style(filepath, style), which takes as inputtwo arguments: (1) filepath, which can be either IEEEexample.docx or APAexample.docxand (2) style (a string being either IEEE or APA), and swaps their citation style (i.e.,converts IEEE citations into APA and vice versa). You are not expected to consider casesoutside the two documents provided.Detail instructions:• To ease the task, you will be working with .docx files (working with PDFs or onlinesources would be more difficult). Two example files (IEEEexample.docx andAPAexample.docx) are provided in Learning Central.• Use the python-docx package to read, manipulate, and save doc files. You can installit using e.g. pip install python-docx. Check the webpage (https://pythondocx.readthedocs.io/en/latest/index.html#)or other online sources to familiarizeyourself with the package.• After conversion, save the file by appending ‘_APA_style’ or ‘_IEEE_style’ to thefilename (e.g. ‘myfile_IEEE_style.docx’).• We make the following simplificationso In the reference list, you do not need to change the formatting of individualreferences. Only make sure that there is numbering (for IEEE style) asopposed to no numbering (for APA).o For APA, the reference list should be sorted alphabetically. Example :IEEE After conversion to APA1. X. F. Li, The practice of life-insurance actuary,Tianjin:NanKai University press, 2000.2. S. H. Lu, Information asymmetry and the Strategy of lifeinsurance underwriting, Insurance Studies, no. 9, pp. 39-40, Sep. 2003.3. X. A. Wang, The underwriting of annuity insurance,Insurance Studies, no. 3, pp. 45-46, Mar. 2004.4. J. W. Han, M. Kamber, Data Mining: Concepts andTechniques, San Francisco:Morgan Kaufmann Publishers,2001.J. W. Han, M. Kamber, Data Mining: Concepts andTechniques, San Francisco:Morgan KaufmannPublishers, 2001.X. F. Li, The practice of life-insurance actuary,Tianjin:NanKai University press, 2000.S. H. Lu, Information asymmetry and the Strategy oflife insurance underwriting, Insurance Studies, no. 9,pp. 39-40, Sep. 2003.X. A. Wang, The underwriting of annuity insurance,Insurance Studies, no. 3, pp. 45-46, Mar. 2004.o For IEEE, the reference list should be sorted numerically (smaller to greater),where 1 refers to the first in-text citation in the paper, 2 refers to the nextcitation, and so on. Example:APA After conversion to IEEECialdini, R. B. (2005). Whats the best secret device forengaging student interest? The answer is in the title. J. Soc.Clin. Psychol. 24, 22–29. doi: 10.1521/jscp.24.1.22.59166…Vaughn, L., and Schick, T. (1999). How to Think AboutWeird Things: Critical Thinking for a New Age. MountainView, CA: Mayfield Pub.…Willingham, D. T. (2008). Critical thinking: Why is it sohard to teach? Arts Educ. Policy Rev. 109, 21–32.[1] Willingham, D. T. (2008). Critical thinking: Why isit so hard to teach? Arts Educ. Policy Rev. 109, 21–32.[2] Cialdini, R. B. (2005). Whats the best secret devicefor engaging student interest? The answer is in the title.J. Soc. Clin. Psychol. 24, 22–29. doi:10.1521/jscp.24.1.22.59166[3] Vaughn, L., and Schick, T. (1999). How to ThinkAbout Weird Things: Critical Thinking for a New Age.Mountain View, CA: Mayfield Pub.…o Your program should re-format all in-text citations.• To implement your programme, you should only use basic Python including stringoperations, as well as the docx module. Usage of Numpy, Pandas, the regularexpression module re, or any other modules not used in the first 4 lectures is notpermitted!As a starting point, use Q3.py from Learning Central. Do not rename the file or the function.Learning Outcomes Assessed• Using the Python programming language to complete programming tasks• Familiarity with basic programming concepts and data structures• Reading and writing filesCriteria for assessmentCredit will be awarded against the following criteria; the coursework will allow students todemonstrate their knowledge and practical skills and to apply the principles taught inlectures. The functions you have implemented will be tested against different data sets. Thescore each implemented function receives is judged by its functionality, efficiency, and/orquality. The below tables explain the specific criteria for each question.Criteria Distinction(70-100%)Merit(60-69%)Pass(50-59%)Fail(0-50%)Q1 Excellent working conditionwith no errorsMostly correct. Minor errorsin outputMajor problem. Errors inoutputMostly wrong or hardlyimplementedCriteria Distinction(70-100%)Merit(60-69%)Pass(50-59%)Fail(0-50%)Q2 Functionality(70%)fully working application thatdemonstrates an excellentunderstanding of the assignmentproblem using relevant pythonapproach.All required functionality ismet, and the application areworking probably with someminors’ errorsSome of thefunctionalitydeveloped with andincorrect output majorerrors.Faulty application with wrongimplementation and wrongoutputQuality (30%) Figures are elegant and show anexcellent understanding ofvisualisation principles includingtick marks, labels, colouring, andtitles.Figures show a goodunderstanding of visualisationprinciples.Figures show a basicunderstanding ofvisualisationprinciples.Missing figures.Criteria Distinction(70-100%)Merit(60-69%)Pass(50-59%)Fail(0-50%)Q3 Functionality(70%)fully working application thatdemonstrates an excellentunderstanding of the assignmentproblem using relevant pythonapproach.All required functionality ismet, and the application areworking probably with someminors’ errorsSome of thefunctionalitydeveloped with andincorrect output majorerrors.Faulty application with wrongimplementation and wrongoutputEfficiency(15%)Excellent performance passing alltest casesGood performance missedsome test casesPassed some test caseswith incorrect output.Did not pass any test caseQuality (15%) Excellent documentation with usageof __docstring__ and commentsGood documentation withminor missing of comments.Fair documentation. No comments or documentationat all转自:http://www.6daixie.com/contents/3/4483.html

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 219,753评论 6 508
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 93,668评论 3 396
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 166,090评论 0 356
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 59,010评论 1 295
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 68,054评论 6 395
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 51,806评论 1 308
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 40,484评论 3 420
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 39,380评论 0 276
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 45,873评论 1 319
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 38,021评论 3 338
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 40,158评论 1 352
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 35,838评论 5 346
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 41,499评论 3 331
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 32,044评论 0 22
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 33,159评论 1 272
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 48,449评论 3 374
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 45,136评论 2 356

推荐阅读更多精彩内容