1. Install python and IDE for python
1.1 install python
http://kaiwu.city/index.php/python3
https://www.python.org/downloads/
1.2 IDE(Integrated Development Environment) for python
https://hackr.io/blog/best-python-ide
An integrated development environment (IDE) is a software application that helps programmers to develop software efficiently. It's where you build your Python projects!
It increases developer productivity by combining common developer tools such as software editing, building, testing, debugging, and packaging in one easy-to-use graphical user interface (GUI).
Other popular features include code refactoring, code search, code auto-completion, and continuous integration/continuous deployment (CI/CD).
Regardless of your preferred programming language or type of software development, an IDE will be one of your go-to tools.
Moving on to the IDE's cousin, the code editor.
Sometimes mistaken for IDEs, the main difference is that IDEs provide more powerful tools to simplify the coding process.
JupyterLab
Install JupyterLab with pip
:
pip install jupyterlab
Note: If you install JupyterLab with conda or mamba, we recommend using the conda-forge channel.
Once installed, launch JupyterLab with:
jupyter lab
Jupyter Notebook
Install the classic Jupyter Notebook with:
To run the notebook:
2.An introduction to python
2.1 leap year
year = int(input("please type in a four digit year value ")); if year % 4 == 0 and year % 100 != 0: print(year, "is a leap year") elif year % 100 == 0: print(year, "is not a leap year") elif year % 400 ==0: print(year, " is a leap year ") else: print(year, " is not a leap year ") |
2.2 take control of excel
the hotel reservation dataset is downloaded from kaggle
https://www.kaggle.com/datasets/ahsan81/hotel-reservations-classification-dataset
we use a subset (199 records)of the hotel reservation dataset (36275 records).
cmd
install openpyxl library
pip install openpyxl
http://kaiwu.city/openfiles/Hotel_Reservations199.xlsx
import openpyxl as xl; filename ="D:/tdata/hotel_reservation/Hotel_Reservations199.xlsx" print(mr) from openpyxl import Workbook # create a new work # i is the row index # save the excel file |
http://kaiwu.city/openfiles/python_loop_excel.ipynb
choose the weblink,
save link as..
3.sentiment analysis
3.1jupyter notebook
icon_ipynb.png
http://kaiwu.city/openfiles/EN_sentiment_analysis_Disneyland_tripadvisor.ipynb
- Select the weblink
- right-click the mouse,choose 'Save As'
- download EN_sentiment_analysis_Disneyland_tripadvisor.ipynb
3.2dataset
http://kaiwu.city/openfiles/DisneylandReviews.csv
https://github.com/DataScience-in-Tourism
The sample dataset for this chapter includes a few rows. so in this file, the sample dataset has been replaced with the dataset from Disneyland on Kaggle (TripAdvisor). The codes has been adjusted accordingly, correcting a few mistakes.
download weblink
https://www.kaggle.com/datasets/arushchillar/disneyland-reviews
About Dataset
The dataset includes 42,000 reviews of 3 Disneyland branches - Paris, California and Hong Kong, posted by visitors on Trip Advisor.
Column Description:
Review_ID: unique id given to each review
Rating: ranging from 1 (unsatisfied) to 5 (satisfied)
Year_Month: when the reviewer visited the theme park
Reviewer_Location: country of origin of visitor
Review_Text: comments made by visitor
Disneyland_Branch: location of Disneyland Park
3.3datasets after data clean
Hong Kong Disneyland were with 786 reviews in 2019
http://kaiwu.city/openfiles/sentiment_hk_disneyland2019.csv
Hong Kong Disneyland were with 211 reviews in January 2019
http://kaiwu.city/openfiles/sentiment_hk_disneyland2019Jan.csv
3.4book chapter
http://kaiwu.city/openfiles/sentiment_analysis_Applied Data Science in Tourism - Roman Egger.pdf
参考资料:
Kirilenko, A. P., Wang, L., & Stepchenkova, S. O. (2022). Sentiment Analysis: Gaging Opinions of Large Groups. In R. Egger, Applied Data Science in Tourism: Interdisciplinary Approaches, Methodologies, and Applications (pp. 363–374). Springer International Publishing. https://doi.org/10.1007/978-3-030-88389-8_17
(1)springer
https://doi.org/10.1007/978-3-030-88389-8
(2)book site
http://www.datascience-in-tourism.com/
(3)github
https://github.com/DataScience-in-Tourism