SlideShare une entreprise Scribd logo
1  sur  11
Télécharger pour lire hors ligne
TRY PYTHON
for
Excel Developers
Book 1
By David Rojas | www.hedaro.com
Preface
Excel is probably the most popular data analysis tool in the market and most people, including myself,
started their data career working with Excel. This book is for the casual Microsoft Excel user that is
interested in learning Python. Python is gaining a lot of ground and becoming the go-to software for
data analysis. If you are not a programmer or even an engineer, then this book has been created just for
you. The examples below will assume you have never programmed before and will try to mimic similar
tasks you would normally perform using Excel. Step-by-step instructions are provided and the examples
are short so you can read this book in one sitting. After reading the book you should be able to perform
a lot of the data analysis you do in Excel but using Python instead. Enjoy!
What you need for this book
• An up-to-date laptop or desktop
• A web browser (such as Chrome) installed on that laptop or desktop
• An internet connection
• A computer with Python 3 installed, including the following libraries: Pandas and Matplotlib
If you have not or do not know how to install Python, I recommend you start with Try Python – for
Beginners before attempting to continue.
Introduction
If you are going to work with data, then the Python library you will be working with is called Pandas. For
plotting your data, the go-to library is called Matplotlib. Don’t worry if you do not understand what a
library is, just remember that when you hear the word Pandas, think of data analysis (not a cuddly black
and white panda bear eating bamboo shoots). When you hear the work Matplotlib, think about charts
and plots. The rest of the book will cover specific examples that are commonly performed in a
spreadsheet. Are you ready to get started?
Import Libraries
The first lines of code we are going to write are simply to import the libraries that were mentioned in
the introduction; that is Pandas and Matplotlib. At this point please start up a new Jupyter Notebook
and make sure you are programming in Python 3 and not Python 2. If you have no idea what a Jupyter
Notebook is then please start with Try Python – for Beginners or do some Googling. After you have a
notebook running on your computer, type the code in the figure below.
Jupyter Notebook
LINE 01
# Import libraries
In Line one, we started with a pound (#) sign. This is how we write comments in Python. We simply type
a pound (#) sign and anything we write after it will be ignored by Python. You can use comments to
write little notes to yourself so that you can remember what in the world the code you wrote means. Try
it for yourself and see how easy it is.
LINE 02
Import pandas as pd
In line 2, we tell Python to import the library called Pandas and give it a nickname of “pd.”
LINE 03
Import matplotlib as mpl
In line 3, we import Matplotlib and give it a nickname of “mpl.”
LINE 04
Import sys
In line 4, we import the SYS module that comes with Python. The only reason we did this is to print the
version of Python I am using for this book.
LINE 05
%matplotlib inline
Now, line 5 is a bit tricky. This line basically turns on plotting for the Jupyter Notebook. If we did not add
this line, then our plots will not show up. I know this is a little odd, but just remember that we need to
include this line of code in order for our plots to show up.
Note that all we have done until this point is tell Python we want to use the libraries called Pandas and
Matplotlib.
LINE 07, 08, 09
Print(‘Python Version: ‘ + sys.version)
Print(‘Pandas Version: ‘ + pd.__version__)
Print(‘Matplotlib Version: ‘ + mpl.__version__)
In line 7, 8, and 9, we use the PRINT function to print some information on the screen. This information
is simply to make you aware of the version of Python, Pandas, and Matplotlib I am using for this book.

Contenu connexe

En vedette

En vedette (6)

Python在豆瓣的应用
Python在豆瓣的应用Python在豆瓣的应用
Python在豆瓣的应用
 
20 cool things python
20 cool things python20 cool things python
20 cool things python
 
Mixing Python and Java
Mixing Python and JavaMixing Python and Java
Mixing Python and Java
 
Python Advanced – Building on the foundation
Python Advanced – Building on the foundationPython Advanced – Building on the foundation
Python Advanced – Building on the foundation
 
Python入門 : 4日間コース社内トレーニング
Python入門 : 4日間コース社内トレーニングPython入門 : 4日間コース社内トレーニング
Python入門 : 4日間コース社内トレーニング
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Python
 

Dernier

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Dernier (20)

Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 

Try python for excel developers - book 1

  • 1. TRY PYTHON for Excel Developers Book 1 By David Rojas | www.hedaro.com
  • 2. Preface Excel is probably the most popular data analysis tool in the market and most people, including myself, started their data career working with Excel. This book is for the casual Microsoft Excel user that is interested in learning Python. Python is gaining a lot of ground and becoming the go-to software for data analysis. If you are not a programmer or even an engineer, then this book has been created just for you. The examples below will assume you have never programmed before and will try to mimic similar tasks you would normally perform using Excel. Step-by-step instructions are provided and the examples are short so you can read this book in one sitting. After reading the book you should be able to perform a lot of the data analysis you do in Excel but using Python instead. Enjoy!
  • 3. What you need for this book • An up-to-date laptop or desktop • A web browser (such as Chrome) installed on that laptop or desktop • An internet connection • A computer with Python 3 installed, including the following libraries: Pandas and Matplotlib If you have not or do not know how to install Python, I recommend you start with Try Python – for Beginners before attempting to continue.
  • 4. Introduction If you are going to work with data, then the Python library you will be working with is called Pandas. For plotting your data, the go-to library is called Matplotlib. Don’t worry if you do not understand what a library is, just remember that when you hear the word Pandas, think of data analysis (not a cuddly black and white panda bear eating bamboo shoots). When you hear the work Matplotlib, think about charts and plots. The rest of the book will cover specific examples that are commonly performed in a spreadsheet. Are you ready to get started?
  • 5. Import Libraries The first lines of code we are going to write are simply to import the libraries that were mentioned in the introduction; that is Pandas and Matplotlib. At this point please start up a new Jupyter Notebook and make sure you are programming in Python 3 and not Python 2. If you have no idea what a Jupyter Notebook is then please start with Try Python – for Beginners or do some Googling. After you have a notebook running on your computer, type the code in the figure below. Jupyter Notebook
  • 6. LINE 01 # Import libraries In Line one, we started with a pound (#) sign. This is how we write comments in Python. We simply type a pound (#) sign and anything we write after it will be ignored by Python. You can use comments to write little notes to yourself so that you can remember what in the world the code you wrote means. Try it for yourself and see how easy it is.
  • 7. LINE 02 Import pandas as pd In line 2, we tell Python to import the library called Pandas and give it a nickname of “pd.”
  • 8. LINE 03 Import matplotlib as mpl In line 3, we import Matplotlib and give it a nickname of “mpl.”
  • 9. LINE 04 Import sys In line 4, we import the SYS module that comes with Python. The only reason we did this is to print the version of Python I am using for this book.
  • 10. LINE 05 %matplotlib inline Now, line 5 is a bit tricky. This line basically turns on plotting for the Jupyter Notebook. If we did not add this line, then our plots will not show up. I know this is a little odd, but just remember that we need to include this line of code in order for our plots to show up. Note that all we have done until this point is tell Python we want to use the libraries called Pandas and Matplotlib.
  • 11. LINE 07, 08, 09 Print(‘Python Version: ‘ + sys.version) Print(‘Pandas Version: ‘ + pd.__version__) Print(‘Matplotlib Version: ‘ + mpl.__version__) In line 7, 8, and 9, we use the PRINT function to print some information on the screen. This information is simply to make you aware of the version of Python, Pandas, and Matplotlib I am using for this book.