For over a decade, Python has been used in scientific computing and highly quantitative domains such as finance, oil and gas, physics, and signal processing. It has been used to improve Space Shuttle mission design, process images from the Hubble Space Telescope, and was instrumental in orchestrating the physics experiments which led to the discovery of the Higgs Boson (the so-called "God particle").
Python is easy for analysts to learn and use, but powerful enough to tackle even the most difficult problems in virtually any domain. It integrates well with existing IT infrastructure, and is very platform independent. Among modern languages, its agility and the productivity of Python-based solutions is legendary. Companies of all sizes and in all areas — from the biggest investment banks to the smallest social/mobile web app startups — are using Python to run their business and manage their data.
This tutorial was developed using Eclipse IDE.
In order to run Python in Eclipse, go to Help -> Install new Software ... -> and use: 'Pydev p2 Repository - http://pydev.sf.net/updates/'
This tutorial was developed using Python 3.6.1
To Download Python:
https://www.python.org/downloads/
Installing packages (Pandas) :
Next, go to your terminal or cmd.exe, and type:pip install pandas. Did you get a "pip is not a recognized command" or something similar? No problem, this means pip is not on your PATH. Pip is a program, but your machine doesn't just simply know where it is unless it is on your PATH. You can look up how to add something to your path if you like, but you can always just explicitly give the path to the program you want to execute. On Windows, for example, Python's pip is located in C:/Python34/Scripts/pip. Python34 means Python 3.4. If you have Python 3.6, then you would use Python36, and so on.
Thus, if regular pip install pandas didn't work, then you can do
C:/Python34/Scripts/pip install pandas
Matplotlib library:
C:/Python34/Scripts/pip install matplotlib
I am going to show you some Python code in which we can see how to manipulate some data using Pandas module ...
The next code pulls data for Exxon from the Yahoo Finance API, storing the data to our data1 variable.from pandas_datareader import data import datetime as dt ''' This pulls data for Exxon from the Yahoo Finance API ''' ticker = 'XOM' start = dt.datetime(2010, 1, 1) end = dt.datetime(2015, 8, 22) data1 = data.DataReader(ticker,'yahoo',start,end) print(data1) print(data1.head())
Pandas works great with other modules, Matplotlib being one of them. Let's see! Open your terminal or cmd.exe, and do pip install matplotlib. You should already have got it I am prety sure with your pandas installation, but we want to make sure
from pandas_datareader import data import datetime as dt import matplotlib.pyplot as plt from matplotlib import style ''' This pulls data for Exxon from the Yahoo Finance API ''' ticker = 'XOM' start = dt.datetime(2010, 1, 1) end = dt.datetime(2015, 8, 22) data1 = data.DataReader(ticker,'yahoo',start,end) style.use('fivethirtyeight') data1['High'].plot() plt.legend() plt.show()
You can download the complete project with this Python code using Pandas to manipulate data from my GitHub repository:
https://github.com/rolando-febrero/Python_DataSets_and_Pandas
Programming thought of the day:
- Funny facts about Google users:
50% of people use Google well as a search engine.
The rest 50 % of them use it to check if their internet is connected ....
No comments:
Post a Comment