Python and R Perform Advanced Analysis Using The Power of Analytical Languages 2nd Edition 55558576
Python and R Perform Advanced Analysis Using The Power of Analytical Languages 2nd Edition 55558576
com
OR CLICK HERE
DOWLOAD EBOOK
(Ebook) Biota Grow 2C gather 2C cook by Loucas, Jason; Viles, James ISBN
9781459699816, 9781743365571, 9781925268492, 1459699815, 1743365578, 1925268497
https://ebooknice.com/product/biota-grow-2c-gather-2c-cook-6661374
ebooknice.com
(Ebook) Matematik 5000+ Kurs 2c Lärobok by Lena Alfredsson, Hans Heikne, Sanna
Bodemyr ISBN 9789127456600, 9127456609
https://ebooknice.com/product/matematik-5000-kurs-2c-larobok-23848312
ebooknice.com
(Ebook) SAT II Success MATH 1C and 2C 2002 (Peterson's SAT II Success) by Peterson's
ISBN 9780768906677, 0768906679
https://ebooknice.com/product/sat-ii-success-math-1c-and-2c-2002-peterson-s-sat-
ii-success-1722018
ebooknice.com
(Ebook) Cambridge IGCSE and O Level History Workbook 2C - Depth Study: the United
States, 1919-41 2nd Edition by Benjamin Harrison ISBN 9781398375147, 9781398375048,
1398375144, 1398375047
https://ebooknice.com/product/cambridge-igcse-and-o-level-history-
workbook-2c-depth-study-the-united-states-1919-41-2nd-edition-53538044
ebooknice.com
(Ebook) Master SAT II Math 1c and 2c 4th ed (Arco Master the SAT Subject Test: Math
Levels 1 & 2) by Arco ISBN 9780768923049, 0768923042
https://ebooknice.com/product/master-sat-ii-math-1c-and-2c-4th-ed-arco-master-
the-sat-subject-test-math-levels-1-2-2326094
ebooknice.com
(Ebook) Data Analysis with Microsoft Power Bi by Brian Larson ISBN 9781260458626,
1260458628
https://ebooknice.com/product/data-analysis-with-microsoft-power-bi-10676252
ebooknice.com
(Ebook) Expert Data Modeling with Power BI - Second Edition by Soheil Bakhshi
https://ebooknice.com/product/expert-data-modeling-with-power-bi-second-
edition-54777586
ebooknice.com
(Ebook) Power Pivot and Power BI: The Excel User's Guide to DAX, Power Query, Power
BI & Power Pivot in Excel 2010-2016 by Rob Collie, Avichal Singh ISBN 9781615470396,
1615470395
https://ebooknice.com/product/power-pivot-and-power-bi-the-excel-user-s-guide-
to-dax-power-query-power-bi-power-pivot-in-excel-2010-2016-11653304
ebooknice.com
(Ebook) Advanced Analytics With Excel 2019: Perform Data Analysis Using Excel’s Most
Popular Features by Manisha Nigam ISBN 9789389845808, 9389845807
https://ebooknice.com/product/advanced-analytics-with-excel-2019-perform-data-
analysis-using-excels-most-popular-features-56607970
ebooknice.com
Extending Power BI with Python and
R, 2E
Copyright © 2024 Packt Publishing
Every effort has been made in the preparation of this book to ensure
the accuracy of the information presented. However, the information
contained in this book is sold without warranty, either express or
implied. Neither the author, nor Packt Publishing, and its dealers and
distributors will be held liable for any damages caused or alleged to
be caused directly or indirectly by this book.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK
ISBN: 978-1-83763-953-3
www.packt.com
Table of Contents
1. Extending Power BI with Python and R, Second Edition: Perform
advanced analysis using the power of analytical languages
2. 1 Where and How to Use R and Python Scripts in Power BI
I. Join our book community on Discord
II. Technical requirements
III. Injecting R or Python scripts into Power BI
i. Data loading
ii. Data transformation
iii. Data visualization
IV. Using R and Python to interact with your data
V. Python and R compatibility across Power BI products
VI. Summary
VII. Test your knowledge
i. Answers
3. 2 Configuring R with Power BI
I. Join our book community on Discord
II. Technical requirements
III. The available R engines
i. The CRAN R distribution
ii. The Microsoft R Open distribution and MRAN
iii. Multi-threading in MRO
IV. Choosing an R engine to install
i. The R engines used by Power BI
ii. Installing the suggested R engines
iii. The R engine for data transformation
iv. The R engine for R script visuals on the Power BI
service
V. Installing an IDE for R development
i. Installing RStudio
ii. Installing RTools
iii. Linking Intel’s MKL to R
VI. Configuring Power BI Desktop to work with R
i. Debugging an R script visual
VII. Configuring the Power BI service to work with R
i. Installing the on-premises data gateway in personal
mode
ii. Sharing reports that use R scripts in the Power BI
service
VIII. R script visuals limitations
IX. Summary
X. Test your knowledge
i. Answers
4. 3 Configuring Python with Power BI
I. Join our book community on Discord
II. Technical requirements
III. The available Python engines
i. Choosing a Python engine to install
ii. The Python engines used by Power BI
iii. Installing the suggested Python engines
iv. The Python engine for data transformation
IV. Creating an environment for data transformations using pip
V. Creating an optimized environment for data transformations
using conda
VI. Creating an environment for Python script visuals on the
Power BI service
VII. What to do when the Power BI service upgrades the Python
engine
VIII. Installing an IDE for Python development
i. Configuring Python with RStudio
ii. Configuring Python with Visual Studio Code
IX. Configuring Power BI Desktop to work with Python
i. Configuring the Power BI service to work with Python
X. Limitations of Python visuals
XI. Summary
XII. Test your knowledge
i. Answers
5. 4 Solving Common Issues When Using Python and R in Power
BI
I. Join our book community on Discord
II. Technical Requirements
III. Avoiding the ADO.NET error when running a Python script
in Power BI
i. The real cause of the problem
ii. A practical solution to the problem
IV. Avoiding the Formula.Firewall error
i. Incompatible privacy levels
ii. Indirect access to a data source
V. Using multiple datasets in Python and R script steps
i. Applying a full join with Merge
ii. Using arguments of the Python.Execute function
VI. Dealing with dates/times in Python and R script steps
VII. Summary
VIII. Test your knowledge
i. Answers
6. 5 Importing Unhandled Data Objects
I. Join our book community on Discord
II. Technical requirements
III. Importing RDS files in R
i. A brief introduction to Tidyverse
ii. Creating a serialized R object
iii. Using an RDS file in Power BI
IV. Importing PKL files in Python
i. A very short introduction to the PyData world
ii. Creating a serialized Python object
iii. Using a PKL file in Power BI
V. Summary
VI. References
VII. Test your knowledge
i. Answers
7. 6 Using Regular Expressions in Power BI
I. Join our book community on Discord
II. Technical requirements
III. A brief introduction to regexes
i. The basics of regexes
ii. Checking the validity of email addresses
iii. Checking the validity of dates
IV. Validating data using regex in Power BI
i. Using regex in Power BI to validate emails with Python
ii. Using regex in Power BI to validate emails with R
iii. Using regex in Power BI to validate dates with Python
iv. Using regex in Power BI to validate dates with R
V. Loading complex log files using regex in Power BI
i. Apache access logs
ii. Importing Apache access logs in Power BI with Python
iii. Importing Apache access logs in Power BI with R
VI. Extracting values from text using regex in Power BI
i. One regex to rule them all
ii. Using regex in Power BI to extract values with Python
iii. Using regex in Power BI to extract values with R
VII. Summary
VIII. References
IX. Test your knowledge
i. Answers
8. 7 Anonymizing and Pseudonymizing Your Data in Power BI
I. Join our book community on Discord
II. Technical requirements
III. De-identifying data
i. De-identification techniques
ii. Understanding pseudonymization
iii. What is anonymization?
IV. Anonymizing data in Power BI
i. Anonymizing data using Python
ii. Anonymizing data using R
V. Pseudonymizing data in Power BI
i. Pseudonymizing data using Python
ii. Pseudonymizing data using R
VI. Summary
VII. References
VIII. Test your knowledge
i. Answers
9. 8 Logging Data from Power BI to External Sources
I. Join our book community on Discord
II. Technical requirements
III. Logging to CSV files
i. Logging to CSV files with Python
ii. Logging to CSV files with R
IV. Logging to Excel files
i. Logging to Excel files with Python
ii. Logging to Excel files with R
V. Logging to (Azure) SQL Server
i. Installing SQL Server Express
ii. Creating an Azure SQL database
iii. Logging to an (Azure) SQL Server with Python
iv. Logging to an (Azure) SQL server with R
v. Managing credentials in the code
VI. Summary
VII. References
VIII. Test your knowledge
i. Answers
10. 9 Loading Large Datasets beyond the Available RAM in Power BI
I. Join our book community on Discord
II. Technical requirements
III. A typical analytic scenario using large datasets
IV. Importing large datasets with Python
i. Installing Dask on your laptop
ii. Creating a Dask DataFrame
iii. Extracting information from a Dask DataFrame
iv. Importing a large dataset in Power BI with Python
V. Importing large datasets with R
i. Introducing Apache Arrow
ii. Installing arrow on your laptop
iii. Creating and extracting information from an Arrow
Dataset object
iv. Importing a large dataset in Power BI with R
VI. Summary
VII. References
11. 10 Boosting Data Loading Speed in Power BI with Parquet
Format
I. Join our book community on Discord
II. Technical Requirements
III. From CSV to the Parquet file format
i. Limitations of using Parquet files natively in Power BI
ii. Using Parquet files with Python
iii. Using Parquet files with R
IV. Using the Parquet format to speed up a Power BI report
i. Transforming historical data in Parquet
ii. Appending new data to and analyze the Parquet
dataset
iii. Analyzing Parquet data in Power BI with Python
iv. Analyzing Parquet data in Power BI with R
V. Summary
VI. References
VII. Test your knowledge
i. Answers
Extending Power BI with Python and
R, Second Edition: Perform
advanced analysis using the power
of analytical languages
Welcome to Packt Early Access. We’re giving you an exclusive
preview of this book before it goes on sale. It can take many months
to write a book, but our authors have cutting-edge information to
share with you today. Early Access gives you an insight into the
latest developments by making chapter drafts available. The
chapters may be a little rough around the edges right now, but our
authors will update them over time.You can dip in and out of this
book or follow along from start to finish; Early Access is designed to
be flexible. We hope you enjoy getting to know more about the
process of writing a Packt book.
Technical requirements
This chapter requires you to have Power BI Desktop already
installed on your machine (you can download it here:
https://aka.ms/pbiSingleInstaller). The version used in this chapter
is 2.110.1161.0 64-bit (October 2022).
Data loading
One of the first steps required to work with data in Power BI
Desktop is to import it from external sources:
1. There are many connectors that allow you to do this, depending
on the respective data sources, but you can also do it via scripts
in Python and R. In fact, if you click on the Get data icon in the
ribbon, not only the most commonly used connectors are shown
but you can also select other ones from a more complete list by
clicking on More...:
Figure 1.2 – Showing R script and Python script in the Get Data
window
As you can see, it's definitely a very skimpy editor, but in Chapter 3,
Configuring Python with Power BI, you'll discover how you can utilize
your preferred IDE to create your scripts within a more
comprehensive and feature-rich editor.
1. Simply click on Get data and then Web to import data directly
from a web page:
Figure 1.5 – Select the Web connector to import data from a
web page
2. You can now enter the previously mentioned URL in the window
that pops up:
Right after clicking OK, a window will pop up with a preview of the
data to be imported.
If you carefully read the comment in the text box, you will see that
the dataset variable is already initialized and contains the data
present at that moment in Power Query Editor, including any
transformations already applied. At this point, you can insert your
Python code in the text box to transform the data into the desired
form.
Data visualization
Finally, your own Python or R scripts can be added to Power BI to
create new visualizations, in addition to those already present in the
tool out of the box:
2. After the data import is complete, you can select either the R
script visual or Python script visual option in the
Visualizations pane of Power BI:
Figure 1.12 – The R and Python script visuals
Apart from the licenses, which we will not go into here, a summary
figure of the relationships between the previously mentioned
products follows:
Exploring the Variety of Random
Documents with Different Content
The Marquesans, struck by the glitter of brass buttons and gold
braid, of broadcloth and fur, unfamiliar with metal, and admiring
everything foreign, fell facile victims to vestures, and when the new-
fangled religions that followed hot upon the discoverers, enforced
covering by dogma and even by punishment, they clothed
themselves and sweated in fashion and sanctity. But clothes irk the
Marquesans as they do all people living close to a kindly nature. Our
own babes resent even the swaddles which bind them in the cradle.
The first years of childhood are a continuing struggle against
garments, until, having lost plasticity and the instant response of
muscle to mind that distinguishes the Marquesans, the result is
rationalized by adolescents into modesty and convention. After
youth, clothing is welcomed by us to enhance imperfect charms and
to hide defects, to screen our unhandsome and puny bodies. The
lean shanks, protuberant abdomens, and anatomical grotesqueries in
a public bath bear witness to our sacrifice. Marriage is often a
disclosure of unguessed flaws.
“The gods are naked and in the open,” said Seneca.
Pigalle sculptured the frail old Voltaire in the nude, yet attained
dignity. Even Broadway smiles at frocked heroes in bronze, and must
have its ideals in marble or bronze undraped.
How often, when I lived at the spacious home of my friend,
Ariioehau Ameroearao, the chief at Mataiea in Tahiti, I have seen
him, chevalier of the Legion of Honor, come in from the highway in
stiff white linen or in religious black, and in a twinkling reduce his
garb to a loin-cloth!
His walls were hung with portraits of princes and distinguished
travelers, guests of his in the past score of years, and none was
more distinguished, though in brilliant uniform and gorgeously
decorated, than the old chief in his strip of cotton print.
“Three kings naked have I seen, and never a sign of royalty,” said
the cynical Bismarck.
Plato understood very well the spirit in which the Polynesians were
clothed by the whites, the crass prurience that pointed out to them
the wickedness of nudity, that hid their beautiful bodies under tunics
and pantaloons, that laughed at their simplicity.
In the “Republic” he says:
Not long since it was thought discreditable and ridiculous among the
Greeks, as it is now among most barbarian nations, for men to be seen
naked. And when the Cretans first, and after them the Lacedæmonians,
began the practice of gymnastic exercises, the wits of the time had it in
their power to make sport of those novelties. But when experience has
shown that it was better to strip than to cover up the body and when the
ridiculous effect that this plan had to the eye had given way before the
arguments establishing its superiority, it was at the same time, as I
imagine, demonstrated that he is a fool who thinks anything ridiculous
but that which is evil, and who attempts to raise a laugh by assuming
any object to be ridiculous but that which is unwise and evil.
“The judges seized the flambeaux and scrutinized closely the faces
of the men. First one yielded and then another. Try as they might to
be as the rocks of the High Place, they felt the heat and melted. A
dozen were told off in the first few minutes of Titihuti’s dance,
though Tahiatini and Moeo had won but two or three. Faster grew
the music, and faster spun about her hips the torso of Titihuti. The
judges caught the rhythm. They themselves were convulsed by the
spell of the girl. The whole line of the silent hundred was breaking
when, as the breadfruit falls from the tree, suddenly sprang upon
the mead the foreigner who had come but that day. Though others
of the ship tried to hold him, he broke from them, and, clasping
Titihuti in his arms, declared that she was his, and that he would
defend his capture. The drums were quieted, the judges rushed to
the pair, and, for the time of a wave’s lapping the beach, spears
were seized.
“But the ritual of the rum began, and in the crush about the cask
the judges awarded Titihuti the Orchid of the Bird, the reward of the
First Dancer. She stood in the light of the now dying torches, and
when the foreigner would embrace her and lead her away she
turned her laughing eyes toward him and called out so that many
heard:
“‘You are without ornament, O Haoe. Cover your face as do
Marquesan lovers, or get you back to your island!’
“Then she hurried away to receive the praise and to taste the
glory of her achievement among her own family.”
The Taua took his long knife and with repeated blows hacked off
the upper half of a cocoanut to make ready another drink. I had a
very vivid idea of the situation he had described. That handsome
young man of Europe, belike of wealth, seeking to surrender to his
vagrant fancies in this contrasting environment, and finding that
among these savages he had position only as his rum bought it with
the men, and was without it at all among the women. One could
fancy him all afire after that dance of abandon, ready on the instant
to yield to the deepest of all instincts, and surprised, astounded,
almost unbelieving at his repulse. He might have learned that such
repulse was not even in the manner of the Marquesans, but solely
the whim of Titihuti, the beginning of that career of whimsical
passion and insouciance which carried her fame from island to island
and fetched other proud whites from afar to know her favor. He
himself had come a long way to be the unwitting victim of the most
prankish girl and woman who ever danced a tribe to death and
destruction, but who withal was worth more than she who launched
the thousand ships to batter Ilium’s towers.
“And did he cover his face?” I demanded, hurrying to follow the
windings of fate.
“E!” said the sorcerer. “He gained the friendship of chiefs. He let
his ship sail away with but a paper with words to his tribe, and he
stayed on. He hunted, he swam, and he drank, but he could not
touch his nose to the nose of Titihuti, for his nose was naked. Weeks
passed, but not his passion. He hovered about her as the great moth
seeks the fireflies, but ever she was busied with her pomades and
her massage, the ena unguent and the baths, the omi omi and the
combing of her red-gold tresses. She had set him aflame, but had no
alleviation for him.
“And then when the moon was at its height she danced again, this
time alone, as the undisputed vehine haka of Fatuhiva. The foreigner
sat and gazed, and when Titihuti glided to where he was and,
planting her feet a metero away, addressed herself to him, he shook
with longing. She was perfumed with the jasmine, and about her
breasts were rings of those pink orchids of the mountains. The
foreigner felt the warmth of her presence as she posed in the
attitudes of love. He bounded to his feet and, clasping her for the
second time to him, he shouted that he would be tattooed, he would
be a man among men in the Marquesas.
“There was no delay; I myself tattooed him. As always the
custom, I took him into the mountains and built the patiki, the house
for the rite. That is as it should be, for tattooing is of our gods and
of our religion before the whites destroyed it. I was and am the
master of our arts. I did not sketch out my design upon his skin with
burned bamboo, as do some, but struck home the ama ink directly.
My needles were the bones of one whom I had slain, an enemy of
the Oi tribe. I myself gathered the candlenuts and, burning them to
powder, mixed that with water and made my color. My mallet, or
hama, was the shin of another whom I had eaten.”
Such a man as Leonardo, who painted “Mona Lisa” and designed a
hundred other beautiful things, or Cellini of the book and a vast
creation of intricate marvels, would have understood the exactness
of that art of tattooing in the Marquesas. Suppose “Mona Lisa”
herself, an expanse of her fair back, and not mere linen, bore her
picture. What infinite pains! Not more than took the taua in such a
task. In his mind his plan, he dipped his needle in the ama soot,
and, placing the point upon a pore of the flesh, he lightly tapped the
other extremity of the bone with his hama of shin and impressed the
sepia into the living skin, for each point of flesh making a stroke.
Followed fever after several hours of frightful anguish. The dentist
is the ministrant of caresses, his the loved hand of pleasure,
compared with the suffering caused to the quivering body by the
blows of those needles. A séance of tattooing followed, and several
days of sickness. He had not the strength of the natives in the pain,
and often he cried out, but yet he signed that the tattooing should
go on.
“Across his eyes upon the lids, and from ear to ear, I made a line
as wide as two of your teeth, and I crossed lines as wide from the
corners of his forehead to the corners of his chin. As he was to be
admitted to the Lodge of Tattooers, I put upon his brow the sacred
shark as big as Titihuti’s hand. I was four moons in all that, and all
the time he must lie within his hut, never leaving it or speaking. I
handed him food and nursed him between my work. Upon our
darker skin the black candlenut ink is, as you know, as blue as the
deep waters of the sea, but on him it was black as night, for his
flesh was white.
“He was handsome as ever god of war in the High Place, that
foreigner, and terrible to behold. His eyes of blue in their black
frames were as threatening as the thunders of the ocean, and above
the black shark glistened his hair, as yellow as the sands of the
shore. A breadfruit season had passed when we descended the
mountain, and he was received into the tribe of Hanavave. We called
him Tohiki for his splendor, though his name was Villee, as we could
say it.”
There is a curious quibble in the recital of the Polynesian. He
arrives at a crisis of his tale, and avoids it for a piece of wit or an idle
remark. Perhaps it is to pique the listener’s interest, to deepen his
attention, or it is but the etiquette of the bard.
“Titihuti?” I interposed.
“Tuitui!” he ejaculated. “You put weeds in my mouth. That girl,
that Titihuti, had left her paepae and vanished. Some said she dwelt
with a lover in another valley. Others that she had been captured at
night by the men of Oi Valley. It was always our effort to seize the
women of other tribes. They made the race stronger. But Titihuti
was not in Oi or with a lover. Her love was her beauty, and soon we
learned that she was gone into the hills herself to be tattooed. You,
American, have seen her legs, and know the full year she gave to
those. They are even to-day the hana metai oko, the loveliest and
most perfect of all living things.”
“And Willie, the splendid Tokihi, what said he?”
“Aue! He dashed up and down the valleys seeking her. He offered
gifts for her return. He cried and he drank. But the tattooing is tabu,
and it would have been death to have entered the hut where she
was against the wish of the artist. Then he turned on me and cursed
me, and often he sat and looked at himself in the pool in the brook
by his own paepae. That foreigner lost his good heart. No longer
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebooknice.com