Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Extending Power BI with Python and R

You're reading from   Extending Power BI with Python and R Ingest, transform, enrich, and visualize data using the power of analytical languages

Arrow left icon
Product type Paperback
Published in Nov 2021
Publisher Packt
ISBN-13 9781801078207
Length 558 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Luca Zavarella Luca Zavarella
Author Profile Icon Luca Zavarella
Luca Zavarella
Arrow right icon
View More author details
Toc

Table of Contents (22) Chapters Close

Preface 1. Section 1: Best Practices for Using R and Python in Power BI
2. Chapter 1: Where and How to Use R and Python Scripts in Power BI FREE CHAPTER 3. Chapter 2: Configuring R with Power BI 4. Chapter 3: Configuring Python with Power BI 5. Section 2: Data Ingestion and Transformation with R and Python in Power BI
6. Chapter 4: Importing Unhandled Data Objects 7. Chapter 5: Using Regular Expressions in Power BI 8. Chapter 6: Anonymizing and Pseudonymizing Your Data in Power BI 9. Chapter 7: Logging Data from Power BI to External Sources 10. Chapter 8: Loading Large Datasets beyond the Available RAM in Power BI 11. Section 3: Data Enrichment with R and Python in Power BI
12. Chapter 9: Calling External APIs to Enrich Your Data 13. Chapter 10: Calculating Columns Using Complex Algorithms 14. Chapter 11: Adding Statistics Insights: Associations 15. Chapter 12: Adding Statistics Insights: Outliers and Missing Values 16. Chapter 13: Using Machine Learning without Premium or Embedded Capacity 17. Section 3: Data Visualization with R in Power BI
18. Chapter 14: Exploratory Data Analysis 19. Chapter 15: Advanced Visualizations 20. Chapter 16: Interactive R Custom Visuals 21. Other Books You May Enjoy

Implementing distances using R

The scenario will be the same as the one already described in the previous section. We will therefore enrich the data relating to some hotels in New York City with the distances separating them from the two major airports of New York, namely John F. Kennedy and LaGuardia.

The files containing the data to be processed can be found in the Chapter10 folder of the GitHub repository. In detail, you will find the hotels data in the hotels-ny.xlsx file and the airports data in the airport-codes.csv file.

Calculating distances with R

The R community is also fortunate to have a freely available package that implements spherical trigonometry functions for geographic applications. The package is called geosphere (https://cran.r-project.org/web/packages/geosphere/) and, like the Python PyGeodesy package, it is inspired by the code that Chris Veness and Charles Karney have made publicly available.

First, you need to install this new package:

  1. Open...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime