CS602留学生作业代做、代写Programming课程作业、代做Python语言作业、Python编程设计作业调试

日期:2019-12-06 10:50

CS602 - Data-Driven Development with Python Fall 2019 Programming Assignment 6

1

Programming Assignment 6

Getting started

Review class handouts and examples, work on the reading and practice assignments posted on the course

schedule. This assignment is designed to practice data manipulation with Pandas and plotting with

Matplotlib.

Programming Project: Plotting worth: 25 points

Create a plot and barcharts visualizing hotel ratings.

Data and program overview

In this assignment you will be working with data on hotel reviews. The task will be to create a plot showing

mean ratings and number of reviews for a selection of hotels in a chosen state, and a barchart that shows

percentage of reviews.

The following data will be provided using csv files:

? A table with information on hotel location (hotels.csv); we will call this the hotel data.

? A table with records of customer reviews of their stays in the hotels (hotelreviews.csv); referred to

henceforth as the reviews data.

Each review references the hotel name and city; these parameters uniquely identify the

corresponding hotel in the hotel data.

The files are supplied in a zip file, which will create a data subfolder, when unpacked. Review the data

before you read the rest of this handout.

Overview of the program

The program should work as follows.

1. Ask the user for the subfolder and names of the two data files (see interaction).

2. Ask the user to enter a state, verifying that the state is one of the states for which hotel

information is available in the hotel data. If user input for the state was not found in the

appropriate column in hotel data, user input must be repeated, until a valid state is entered.

3. Identify all cities with a hotel in the state, based on the hotel data. Provide a numbered sequence of

cities in the specified state and ask the user to enter up to four numbers from the list. Input should

be repeated until the user enters one to four numbers from the numbered list. You may assume the

user will be entering numbers only.

4. Identify all hotels that are located in the selected city(s) (you can assume city names are unique

across all states). Display the names of these hotels.

5. Display a hotel reviews plot (described below), and save the plot as plot1.jpg file using

plt.savefig() function.

6. For the three highest rated hotels among the selected, display a rating percentage barchart

showing percentage of reviews with specific ratings (described below). Save these plots as

barchart1.jpg, barchart2.jpg, barchart3.jpg,

Sample interactions: user input appears in boldface with the generated plots shown after the text of the

interaction.

Please enter names of the subfolder and files: data hotels.csv hotelreviews.csv

CS602 - Data-Driven Development with Python Fall 2019 Programming Assignment 6

2

Please enter state, e.g. MA: MA

1 Auburn

2 Boston

3 Brockton

4 Cambridge

5 Fitchburg

6 West Springfield

dtype: object

Select cities from above list by entering up to four indices on the same line: 2 4

You have selected the following cities:

city

2 Boston

4 Cambridge

Displaying rating information for the following hotels:

name city province

0 The Inn @ St. Botolph Boston MA

1 40 Berkeley Hostel Boston MA

2 A Bed & Breakfast In Cambridge Cambridge MA

3 Holiday Inn Express Hotel and Suites Cambridge Cambridge MA

Exiting...

CS602 - Data-Driven Development with Python Fall 2019 Programming Assignment 6

3

The following interaction demonstrates how invalid input should be handled and the messages to be

shown for invalid input (highlighted). The graphs are omitted.

Please enter names of the subfolder and files: data hotels.csv hotelreviews.csv

Please enter state, e.g. MA: Provence

We have no data on hotels in Provence

Please enter state, e.g. MA: az

We have no data on hotels in az

Please enter state, e.g. MA: AZ

1 Eloy

2 Glendale

3 Mesa

4 Payson

5 Phoenix

6 Prescott Valley

7 Tucson

8 Wellton

dtype: object

Select cities from above list by entering up to four indices on the same line: 5 6 8

10

Selection must range from 1 to 8

Select cities from above list by entering up to four indices on the same line: 1 2 3

4 5 6 7

You selected 7 items, must select up to four

Select cities from above list by entering up to four indices on the same line: 5 7

You have selected the following cities:

city

5 Phoenix

7 Tucson

Displaying rating information for the following hotels:

name city province

0 La Quinta Inn and Suites Tucson - Reid Park Tucson AZ

1 La Posada Lodge & Casitas, An Ascend Hotel Col... Tucson AZ

2 Residence Inn By Marriott Tucson Williams Centre Tucson AZ

3 Holiday Inn Express & Suites Phoenix Downtown ... Phoenix AZ

4 Park Terrace Suites Phoenix AZ

Overview of plots

1. Hotel reviews plot is the first plot shown in the interaction.

For each of the hotels in the selected cities, this plot visualizes the number of reviews as a

coordinate on the x axis and the average rating, as a coordinate on the y axis. Hotels must be

displayed as colored points, annotated with the hotel name, and (for full credit) using a color

corresponding to a city, as shown in the plot legend. Axes must be clearly labeled as shown, and the

title should be as shown.

Do not worry about the hotel names overlapping due to placement of annotations, or extending

beyond the plot boundaries.

2. Rating percentage barchart is generated for three of the top-rated hotels. Each barchart

displays a bar graph produced using the Matplotlib function plt.bar(), showing what percentage

of all reviews have the specific rating (1 through 5). This percentage is computed by calculating

CS602 - Data-Driven Development with Python Fall 2019 Programming Assignment 6

4

the total number of reviews with the rating and dividing it by the total number of reviews for the

hotel.

The percentage value must be displayed clearly on top of the bar. Axes must be clearly marked and

labeled as shown, and the title of the chart should include the name of the hotel, its city and state

information as well as the total number of the reviews of the hotel.

Required Functions

Include

? main() to read the location of the input files and call other functions to run the whole program;

? function pickStateAndCities () that will run the state and city selection procedure and return

user chosen state and all cities in it;

? function selectHotelReviews() to select and return reviews for the hotels in the selected cities, so

that the Hotel reviews plot can be generated;

? functions reviewsRatingsPlot() and ratingPercentageBarchart() to generate and save the

appropriate plots.

Pick function parameters and return values as you see fit, and define other functions as needed.

General Requirements

? You can assume that the provided files will have all of the columns involved in the required

computations, but the number and content of records and order of columns may be different.

? Your program should have no code outside of function definitions, except for a single call to main()

and global variables described in the next bullet.

? In order to make the code easier to modify for a different set of column names, define global variables

that store the names of columns that your program uses (e.g. CITY = 'city') and use the global

variables throughout your code.

? All file related operations must use device-independent handling of paths (use os.getcwd() and

os.path.join() functions to create paths, instead of hardcoding them).

Submission and Grading

Submit your code along with the image files that your program will generate for the input data contained in

the first sample interaction. Grading will be based on the accuracy (conforming to all the requirements and

format of the interaction), generality of code and the appropriate use of pandas/numpy/matplotlib resources

(data structures and functions). Two points will be awarded for programming style.

Created by Tamara Babaian on November 23, 2019

python程序设计作业_CS602留学生作业代做、代写Programming课程作业、代做Python语言作业、Python编程设计作业调试...相关推荐

  1. python255多少钱_CS255留学生作业代做、代写Python语言作业、Timetabling作业代做、Python编程设计作业调试...

    CS255留学生作业代做.代写Python语言作业.Timetabling作业代做.Python编程设计作业调试 日期:2019-11-11 11:08 CS255 Artificial Intell ...

  2. matlab留学生作业代做,25877留学生作业代做、代写MATLAB,R编程设计作业、代做MATLAB/R课程作业、代写portfolio作业...

    25877留学生作业代做.代写MATLAB,R编程设计作业.代做MATLAB/R课程作业.代写portfolio作业 日期:2019-06-10 09:48 Financial Markets Ins ...

  3. 课程设计代写java,JAVA课程设计作业代做、代写JAVA编程设计作业、代写data留学生作业...

    JAVA课程设计作业代做.代写JAVA编程设计作业.代写data留学生作业 日期:2020-06-13 11:30 JAVA Coursework (30 marks) Suppose you nee ...

  4. 个人HTML期末大作业~ 个人网页(HTML+CSS)6页面带下拉特效~简单带表格带设计说明 ~学生网页设计作业源码

    HTML期末大作业~ 个人网页6页面带下拉特效~简单带表格带设计说明 ~学生网页设计作业源码 作品介绍 下面介绍一下我的个人小网站吧,我的网站背景稍微单调一点白色,主要个人比较喜欢白色了,布局上面使用 ...

  5. 个人HTML期末大作业~ 个人网页(HTML+CSS)6页面带下拉特效~简单带表格带设计说明 ~学生网页设计作业源码...

    HTML期末大作业~ 个人网页6页面带下拉特效~简单带表格带设计说明 ~学生网页设计作业源码 作品介绍 下面介绍一下我的个人小网站吧,我的网站背景稍微单调一点白色,主要个人比较喜欢白色了,布局上面使用 ...

  6. HTML+CSS大作业——浪漫红色自适应网上鲜花店(16页) HTML+CSS+JavaScript 大学生鲜花网页作品 植物网页设计作业模板 学生网页制作源代码下载

    HTML5期末大作业:红色自适应网上鲜花网站设计--浪漫红色自适应网上鲜花店(16页) HTML+CSS+JavaScript 大学生鲜花网页作品 植物网页设计作业模板 学生网页制作源代码下载 常见网 ...

  7. 3D游戏编程设计作业八

    本次作业五选一,我选择制作血条预制设计,要求如下 血条(Health Bar)的预制设计.具体要求如下 分别使用 IMGUI 和 UGUI 实现 使用 UGUI,血条是游戏对象的一个子元素,任何时候需 ...

  8. web前端期末大作业 绿色环境保护(4个页面) HTML5网站模板农业展示网站 html5网页制作代码 html5网页设计作业代码 html制作网页案例代码

  9. python开发cs程序_CSE209代做、代写Computer Graphics、代做CS/python编程设计代写Python程序|代做Processing...

    CSE209代做.代写Computer Graphics.代做CS/python编程设计代写Python程序|代做ProcessingCSE209 Computer Graphics~1~CSE209 ...

最新文章

  1. 中国·北京创新创业大赛季(2020)参赛企业注册报名操作指南
  2. 【九度OJ】题目1078-二叉树遍历
  3. ZooKeeper实战(一):ZooKeeper原理,详细安装步骤,基本命令,节点间通信原理
  4. android新建view类,android – 无法创建ViewModel类的实例(无法启动活动ComponentInfo)
  5. Android之Base64
  6. php操作xml类,PHP实现的XML操作类【XML Library】
  7. 计算机文言,中国最具有概括性的文言文文字?本人学计算机编程的
  8. 乐易模块V7.62更新日志
  9. 【QT】一份值得学习的QT视频教程
  10. 何凯明团队又出新论文,北大、上交校友教你用ViT做迁移学习
  11. 制作本地视频网站 苹果cms 超详细
  12. 计算机打不开excel表格,excel表格打不开怎么办?excel表格打不开的原因及解决方法...
  13. u-boot-2012.04.01移植到TQ2440
  14. WordPress网站更改后台登录地址保姆级图文教程
  15. python 随手记
  16. python3 题解(54 三阶幻方)
  17. Unity URP管线设置 后处理的使用
  18. linux中如何压缩目录文件,在Linux中,如何压缩文件和目录
  19. smartforms例子
  20. java自定义注解为空值_java 自定义注解

热门文章

  1. 杰里之MIC 和 和 AUX 使用同一个 IO 做信号输入设置】【篇】
  2. Qt movetoThread关闭线程
  3. 国际评测垫底 金山毒霸遭Win8商店“封杀”
  4. 微软 Office for macOS 中文版正式版办公软件
  5. 应急消防通道总是被占用?安防告警视频平台越加必要
  6. 黄帝内经.素问.太阴阳明论篇(29)
  7. 一个服务器网站全部503,win10打不开网页提示503服务器不可用的解决方法
  8. 转载:HTML编写的坦克大战游戏
  9. 中国看风水最好的大师有哪些【转载】
  10. seo技术第一天:SEO是什么