Would you like to gather big datasets, analyze them, and visualize the results, all in one program? If this describes you, then Introduction to Python Programming for Business and Social Science Applications is the book for you. Authors Frederick Kaefer and Paul Kaefer walk you through each step of the Python package installation and analysis process, with frequent exercises throughout so you can immediately try out the functions you’ve learned. Written in straightforward language for those with no programming background, this book will teach you how to use Python for your research and data analysis. Instead of teaching you the principles and practices of programming as a whole, this application-oriented text focuses on only what you need to know to research and answer social science questions. The text features two types of examples, one set from the General Social Survey and one set from a large taxi trip dataset from a major metropolitan area, to help readers understand the possibilities of working with Python. Chapters on installing and working within a programming environment, basic skills, and necessary commands will get you up and running quickly, while chapters on programming logic, data input and output, and data frames help you establish the basic framework for conducting analyses. Further chapters on web scraping, statistical analysis, machine learning, and data visualization help you apply your skills to your research. More advanced information on developing graphical user interfaces (GUIs) help you create functional data products using Python to inform general users of data who don’t work within Python.
First there was IBM® SPSS®, then there was R, and now there′s Python. Statistical software is getting more aggressive – let authors Frederick Kaefer and Paul Kaefer help you tame it with Introduction to Python Programming for Business and Social Science Applications.
Daftar Isi
Preface
Figures and Tables in the Text Related to the GSS Data Set
Figures and Tables in the Text Related to the Taxi Trips Data Set
Python Modules and Packages
Acknowledgments
About the Authors
Chapter 1 • Introduction to Python
Learning Objectives
Introduction
Brief Introduction to Python and Programming
Setting Up a Python Development Environment
Executing Python Code in the IDLE Shell Window
Executing Python Code in Files
Package Managers
Data Sets Used Throughout the Book
Chapter Summary
Glossary
End of Chapter Exercises
References
Chapter 2 • Building Blocks of Programming
Learning Objectives
Introduction
Good Programming Practice
Basic Elements of Python Code
Python Code Statements
Errors
Functions
Using Modules of Python Code
Chapter Summary
Glossary
End of Chapter Exercises
References
Chapter 3 • Further Foundations of Python Programming
Learning Objectives
Introduction
Compound Data Types
Lists
String Objects
Sequence Operations
Tuples
Dictionaries
Example Using Tuples and Dictionaries
Chapter Summary
Glossary
End of Chapter Exercises
References
Chapter 4 • Control Logic and Loops
Learning Objectives
Introduction
Conditions
Conditional Logic
Loops
Error Handling
Chapter Summary
Glossary
End of Chapter Exercises
References
Chapter 5 • Reading and Writing to Files Using Python
Learning Objectives
Introduction
Data Input/Output: Using files
CSV Files
Exporting Our Results
Working With Database Files
Developing an Interactive Application Using a Database
Chapter Summary
Glossary
End of Chapter Exercises
Discussion Questions
References
Chapter 6 • Preparing and Working With Data Using Pandas
Learning Objectives
Introduction
Num Py
Pandas Data Structures
Creating Dummy Variables
Chapter Summary
Glossary
Discussion Questions
End of Chapter Exercises
References
Chapter 7 • Obtaining Data From the Web Using Python
Learning Objectives
Introduction
HTML: The Language of the Web
Using Python to Read From HTML Files
Obtaining GSS Data From the Web: A More Complicated Process
Ethical Issues: Inappropriate Use of Web Resources
Beautiful Soup
JSON: Obtaining Well-Structured Data
REST API Queries: A Standardized Way to Access Well-Structured Data
Chapter Summary
Glossary
Discussion Questions
End of Chapter Exercises
References
Chapter 8 • Statistical Calculations Using Python
Learning Objectives
Introduction
Ethical Issues: Considerations When Working With Statistics and Building Models
Basic Statistics
Using Statistical Modules
Pandas Features
Sci Py Stats Module
Statsmodels Module for Multiple Regression
Statsmodels Module for Logistic Regression
Chapter Summary
Glossary
End of Chapter Exercises
References
Chapter 9 • Data Visualization Using Python
Learning Objectives
Introduction
Data Visualization
Matplotlib: A Python Library to Visualize Your Data
Customizing Matplotlib Plots
Creating 3D Plots
Using Seaborn Package for Statistical Data Visualization
Chapter Summary
Glossary
End of Chapter Exercises
References
Chapter 10 • Machine Learning and Text Mining
Learning Objectives
Introduction
Machine Learning
Supervised Learning
Unsupervised Learning
Using Python for Text Mining
Chapter Summary
Glossary
End of Chapter Exercises
References
Chapter 11 • Developing Graphical User Interfaces With tkinter
Learning Objectives
Introduction
tkinter Background
tkinter Widgets
tkinter Layout Manager
Examples Placing Different Widgets
Writing Python Code to Work With tkinter Widgets
Example Program Using Three tkinter Windows
GUI-Based Database Application
Chapter Summary
Glossary
End of Chapter Exercises
References
Appendix A • Links to Other Resources
Appendix B • Debugging Using IDLE Debug Mode
Appendix C • Timing Code Execution
Appendix D • Solutions to Stop, Code, and Understand! Exercises
Tentang Penulis
Paul Kaefer works as Senior Analytics Engineer at Carrot Health and has instructed two data analytics & visualization bootcamps through Trilogy Education Services. He previously worked for United Healthcare as a Data Scientist. After earning a Bachelor’s degree in Computer Engineering, he earned a Master′s degree in Computational Sciences while leading the Data Analysis Team for the Gas Day project, a research lab at Marquette University that works with energy utilities around the United States to forecast natural gas demand. In addition to his interest in the Python programming language, Paul has certifications in the SAS programming and R programming languages, and is building experience using Tableau.