SlideShare uma empresa Scribd logo
1 de 4
Baixar para ler offline
1 www.quandl.com
NumPy / SciPy / Pandas Cheat Sheet
Select column.
Select row by label.
Return DataFrame index.
Delete given row or column. Pass axis=1 for columns.
Reindex df1 with index of df2.
Reset index, putting old index in column named index.
Change DataFrame index, new indecies set to NaN.
Show first n rows.
Show last n rows.
Sort index.
Sort columns.
Pivot DataFrame, using new conditions.
Transpose DataFrame.
Change lowest level of column labels into innermost row index.
Change innermost row index into lowest level of column labels.
NumPy / SciPy
arr = array([])
arr.shape
convolve(a,b)
arr.reshape()
sum(arr)
mean(arr)
std(arr)
dot(arr1,arr2)
vectorize()
Create a Series.
Create a Dataframe.
Create a Panel.
Pandas
Create Structures
s = Series (data, index)
df = DataFrame (data, index, columns)
p = Panel (data, items, major_axis, minor_axis)
df.stack()
df.unstack()
df.pivot(index,column,values)
df.T
DataFrame commands
df[col]
df.iloc[label]
df.index
df.drop()
df1 = df1.reindex_like(df1,df2)
df.reset_index()
df.reindex()
df.head(n)
df.tail(n)
df.sort()
df.sort(axis=1)
Create numpy array.
Shape of an array.
Linear convolution of two sequences.
Reshape array.
Sum all elements of array.
Compute mean of array.
Compute standard deviation of array.
Compute inner product of two arrays.
Turn a scalar function into one which
accepts & returns vectors.
2 www.quandl.com
Create a time series index.date_range(start, end, freq)
Pandas Time Series
Business Day
Calender day
Weekly
Monthly
Quarterly
Annual
Hourly
B
D
W
M
Q
A
H
Freq has many options including:
Any Structure with a datetime index
Split DataFrame by columns. Creates a GroupBy object (gb).
Apply function (single or list) to a GroupBy object.
Applies function and returns object with same index as one
being grouped.
Filter GroupBy object by a given function.
Return dict whose keys are the unique groups, and values
are axis labels belonging to each group.
Groupby
groupby()
gb.agg()
gb.transform()
gb.filter()
gb.groups
Save to CSV.
Read CSV into DataFrame.
Save to Excel.
Read exel into DataFrame.
I/O
df.to_csv(‘foo.csv’)
read_csv(‘foo.csv’)
to_excel(‘foo.xlsx’, sheet_name)
read_excel(‘foo.xlsx’,’sheet1’, index_col =
None, na_values = [‘NA’])
df.dropna()
df.count()
df.min()
df.max()
df.describe()
concat()
Drops rows where any data is missing.
Returns Series of row counts for every column.
Return minimum of every column.
Return maximum of every column.
Generate various summary statistics for every column.
Merge DataFrame or Series objects.
Apply function to every element in DataFrame.
Apply function along a given axis.
df.applymap()
df.apply()
Resample data with new frequency.ts.resample()
3 www.quandl.com
Select current axis.
Change axis color, none to remove.
Change axis position. Can change coordinate space.
Create legend. Set to ‘best’ for auto placement.
Save plot.
ax=gca()
ax.spines[].set_color()
ax.spines[].set_position()
Label the x-axis.
Label the y-axis.
Title the graph.
Set tick values for x-axis. First array for values, second
for labels.
Set tick values for y-axis. First array for values, second
for labels.
yticks([],[])
Plot data or plot a function against a range.
Create multiple plots; n- number of plots, x - number
horizontally displayed, y- number vertically displayed.
plot()
subplot(n,x,y)
xlabel()
ylabel()
title()	
xticks([],[])
Plotting
Matplotlib is an extremely powerful module.
See www.matplotlib.org for complete documentation.
Quandl is a search engine for numerical data, allowing
easy access to financial, social, and demographic data
from hundreds of sources.
Quandl
The Quandl package enables Quandl API access from
within Python, which makes acquiring and manipulating
numerical data as quick and easy as possible.
In your first Quandl function call you should specifiy your
authtoken (found on Quandl’s website after signing up) to
avoid certain API call limits.
See www.quandl.com/help/packages/python for more.
savefig(‘foo.png’)
legend(loc=’ ‘)
Return data for nearest time interval.
Return data for specific time.
Return data between specific interval.
Convert Pandas DatetimeIndex to datetime.datetime object.
Conver a list of date-like objects (strings, epochs, etc.) to a
DatetimeIndex.
ts.ix[start:end]
ts[]
ts.between_time()
to_pydatetime()
to_datetime()
4 www.quandl.com
Plotting Example
import Quandl as q
import matplotlib.pyplot as plt
rural = q.get(‘WORLDBANK/USA_SP_RUR_TOTL_ZS’)
urban = q.get(‘WORLDBANK/USA_SP_URB_TOTL_IN_ZS’)
plt.subplot(2, 1, 1)				
plt.plot(rural.index,rural)					
	
plt.xticks(rural.index[0::3],[])					
	
plt.title(‘American Population’)					
	
plt.ylabel(‘% Rural’)				
plt.subplot(2, 1, 2)				
plt.plot(urban.index,urban)					
	
plt.xlabel(‘year’)						
plt.ylabel(‘% Urban’)				
plt.show()
Add the following to any function call.
Download Quandl data for a certain Quandl code
as a Dataframe.
Search Quandl. Outputs first 4 results.
Upload a Pandas DataFrame (with a time series index) to
Quandl. Code must be all capital alphanumeric.
authtoken = ‘YOURTOKENHERE’
get(‘QUANDL/CODE’)
search(‘searchterm’)
push(data, code, name)

Mais conteúdo relacionado

Mais procurados

C Programming : Arrays
C Programming : ArraysC Programming : Arrays
C Programming : ArraysGagan Deep
 
Introduction to pandas
Introduction to pandasIntroduction to pandas
Introduction to pandasPiyush rai
 
Data Wrangling with dplyr and tidyr Cheat Sheet
Data Wrangling with dplyr and tidyr Cheat SheetData Wrangling with dplyr and tidyr Cheat Sheet
Data Wrangling with dplyr and tidyr Cheat SheetDr. Volkan OBAN
 
Python seaborn cheat_sheet
Python seaborn cheat_sheetPython seaborn cheat_sheet
Python seaborn cheat_sheetNishant Upadhyay
 
Two dimensional array
Two dimensional arrayTwo dimensional array
Two dimensional arrayRajendran
 
Introduction to Array ppt
Introduction to Array pptIntroduction to Array ppt
Introduction to Array pptsandhya yadav
 
Python - Numpy/Pandas/Matplot Machine Learning Libraries
Python - Numpy/Pandas/Matplot Machine Learning LibrariesPython - Numpy/Pandas/Matplot Machine Learning Libraries
Python - Numpy/Pandas/Matplot Machine Learning LibrariesAndrew Ferlitsch
 
Python For Data Science Cheat Sheet
Python For Data Science Cheat SheetPython For Data Science Cheat Sheet
Python For Data Science Cheat SheetKarlijn Willems
 
Array in c language
Array in c languageArray in c language
Array in c languagehome
 
Programming in c arrays
Programming in c   arraysProgramming in c   arrays
Programming in c arraysUma mohan
 

Mais procurados (20)

C Programming : Arrays
C Programming : ArraysC Programming : Arrays
C Programming : Arrays
 
Introduction to pandas
Introduction to pandasIntroduction to pandas
Introduction to pandas
 
Data Wrangling with dplyr and tidyr Cheat Sheet
Data Wrangling with dplyr and tidyr Cheat SheetData Wrangling with dplyr and tidyr Cheat Sheet
Data Wrangling with dplyr and tidyr Cheat Sheet
 
Arrays in C language
Arrays in C languageArrays in C language
Arrays in C language
 
Arrays
ArraysArrays
Arrays
 
Python seaborn cheat_sheet
Python seaborn cheat_sheetPython seaborn cheat_sheet
Python seaborn cheat_sheet
 
C programming , array 2020
C programming , array 2020C programming , array 2020
C programming , array 2020
 
Arrays in c
Arrays in cArrays in c
Arrays in c
 
Programming in c Arrays
Programming in c ArraysProgramming in c Arrays
Programming in c Arrays
 
Two dimensional array
Two dimensional arrayTwo dimensional array
Two dimensional array
 
C arrays
C arraysC arrays
C arrays
 
Introduction to Array ppt
Introduction to Array pptIntroduction to Array ppt
Introduction to Array ppt
 
C++ lecture 04
C++ lecture 04C++ lecture 04
C++ lecture 04
 
Array in c++
Array in c++Array in c++
Array in c++
 
Data transformation-cheatsheet
Data transformation-cheatsheetData transformation-cheatsheet
Data transformation-cheatsheet
 
Python - Numpy/Pandas/Matplot Machine Learning Libraries
Python - Numpy/Pandas/Matplot Machine Learning LibrariesPython - Numpy/Pandas/Matplot Machine Learning Libraries
Python - Numpy/Pandas/Matplot Machine Learning Libraries
 
Python For Data Science Cheat Sheet
Python For Data Science Cheat SheetPython For Data Science Cheat Sheet
Python For Data Science Cheat Sheet
 
Array in c language
Array in c languageArray in c language
Array in c language
 
Arrays in c
Arrays in cArrays in c
Arrays in c
 
Programming in c arrays
Programming in c   arraysProgramming in c   arrays
Programming in c arrays
 

Destaque

Ccna cheat sheet
Ccna cheat sheetCcna cheat sheet
Ccna cheat sheetaromal4frnz
 
Customer journey maps: the Why and the What
Customer journey maps: the Why and the WhatCustomer journey maps: the Why and the What
Customer journey maps: the Why and the WhatSmaply
 
Thorax and Abdomen CT Cheat Sheet
Thorax and Abdomen CT Cheat SheetThorax and Abdomen CT Cheat Sheet
Thorax and Abdomen CT Cheat SheetChase Allen
 
Effective 15-minute presentations - Cheat Sheet
Effective 15-minute presentations - Cheat SheetEffective 15-minute presentations - Cheat Sheet
Effective 15-minute presentations - Cheat SheetJan Schrage
 
How to evaluate a customer journey map?
How to evaluate a customer journey map?How to evaluate a customer journey map?
How to evaluate a customer journey map?Smaply
 
Ultimate Accounting "Cheat Sheet"
Ultimate Accounting "Cheat Sheet"Ultimate Accounting "Cheat Sheet"
Ultimate Accounting "Cheat Sheet"Joe Jancsics
 

Destaque (7)

Seo cheat-sheet
Seo cheat-sheetSeo cheat-sheet
Seo cheat-sheet
 
Ccna cheat sheet
Ccna cheat sheetCcna cheat sheet
Ccna cheat sheet
 
Customer journey maps: the Why and the What
Customer journey maps: the Why and the WhatCustomer journey maps: the Why and the What
Customer journey maps: the Why and the What
 
Thorax and Abdomen CT Cheat Sheet
Thorax and Abdomen CT Cheat SheetThorax and Abdomen CT Cheat Sheet
Thorax and Abdomen CT Cheat Sheet
 
Effective 15-minute presentations - Cheat Sheet
Effective 15-minute presentations - Cheat SheetEffective 15-minute presentations - Cheat Sheet
Effective 15-minute presentations - Cheat Sheet
 
How to evaluate a customer journey map?
How to evaluate a customer journey map?How to evaluate a customer journey map?
How to evaluate a customer journey map?
 
Ultimate Accounting "Cheat Sheet"
Ultimate Accounting "Cheat Sheet"Ultimate Accounting "Cheat Sheet"
Ultimate Accounting "Cheat Sheet"
 

Semelhante a Pandas,scipy,numpy cheatsheet

Pandas cheat sheet_data science
Pandas cheat sheet_data sciencePandas cheat sheet_data science
Pandas cheat sheet_data scienceSubrata Shaw
 
Data Wrangling with Pandas
Data Wrangling with PandasData Wrangling with Pandas
Data Wrangling with PandasLuis Carrasco
 
R Programming Reference Card
R Programming Reference CardR Programming Reference Card
R Programming Reference CardMaurice Dawson
 
Broom: Converting Statistical Models to Tidy Data Frames
Broom: Converting Statistical Models to Tidy Data FramesBroom: Converting Statistical Models to Tidy Data Frames
Broom: Converting Statistical Models to Tidy Data FramesWork-Bench
 
R command cheatsheet.pdf
R command cheatsheet.pdfR command cheatsheet.pdf
R command cheatsheet.pdfNgcnh947953
 
Short Reference Card for R users.
Short Reference Card for R users.Short Reference Card for R users.
Short Reference Card for R users.Dr. Volkan OBAN
 
Functional programming with_scala
Functional programming with_scalaFunctional programming with_scala
Functional programming with_scalaRaymond Tay
 
pandas dataframe notes.pdf
pandas dataframe notes.pdfpandas dataframe notes.pdf
pandas dataframe notes.pdfAjeshSurejan2
 
Data Analysis with Pandas CheatSheet .pdf
Data Analysis with Pandas CheatSheet .pdfData Analysis with Pandas CheatSheet .pdf
Data Analysis with Pandas CheatSheet .pdfErwin512140
 

Semelhante a Pandas,scipy,numpy cheatsheet (20)

R gráfico
R gráficoR gráfico
R gráfico
 
tidyr.pdf
tidyr.pdftidyr.pdf
tidyr.pdf
 
Pandas cheat sheet_data science
Pandas cheat sheet_data sciencePandas cheat sheet_data science
Pandas cheat sheet_data science
 
Pandas cheat sheet
Pandas cheat sheetPandas cheat sheet
Pandas cheat sheet
 
Data Wrangling with Pandas
Data Wrangling with PandasData Wrangling with Pandas
Data Wrangling with Pandas
 
R Programming Reference Card
R Programming Reference CardR Programming Reference Card
R Programming Reference Card
 
Broom: Converting Statistical Models to Tidy Data Frames
Broom: Converting Statistical Models to Tidy Data FramesBroom: Converting Statistical Models to Tidy Data Frames
Broom: Converting Statistical Models to Tidy Data Frames
 
R command cheatsheet.pdf
R command cheatsheet.pdfR command cheatsheet.pdf
R command cheatsheet.pdf
 
@ R reference
@ R reference@ R reference
@ R reference
 
Short Reference Card for R users.
Short Reference Card for R users.Short Reference Card for R users.
Short Reference Card for R users.
 
Reference card for R
Reference card for RReference card for R
Reference card for R
 
purrr.pdf
purrr.pdfpurrr.pdf
purrr.pdf
 
Functional programming with_scala
Functional programming with_scalaFunctional programming with_scala
Functional programming with_scala
 
20170509 rand db_lesugent
20170509 rand db_lesugent20170509 rand db_lesugent
20170509 rand db_lesugent
 
Data import-cheatsheet
Data import-cheatsheetData import-cheatsheet
Data import-cheatsheet
 
pandas dataframe notes.pdf
pandas dataframe notes.pdfpandas dataframe notes.pdf
pandas dataframe notes.pdf
 
3 Data Structure in R
3 Data Structure in R3 Data Structure in R
3 Data Structure in R
 
Data Analysis with Pandas CheatSheet .pdf
Data Analysis with Pandas CheatSheet .pdfData Analysis with Pandas CheatSheet .pdf
Data Analysis with Pandas CheatSheet .pdf
 
Python for R users
Python for R usersPython for R users
Python for R users
 
Frp2016 3
Frp2016 3Frp2016 3
Frp2016 3
 

Mais de Dr. Volkan OBAN

Conference Paper:IMAGE PROCESSING AND OBJECT DETECTION APPLICATION: INSURANCE...
Conference Paper:IMAGE PROCESSING AND OBJECT DETECTION APPLICATION: INSURANCE...Conference Paper:IMAGE PROCESSING AND OBJECT DETECTION APPLICATION: INSURANCE...
Conference Paper:IMAGE PROCESSING AND OBJECT DETECTION APPLICATION: INSURANCE...Dr. Volkan OBAN
 
Covid19py Python Package - Example
Covid19py  Python Package - ExampleCovid19py  Python Package - Example
Covid19py Python Package - ExampleDr. Volkan OBAN
 
Object detection with Python
Object detection with Python Object detection with Python
Object detection with Python Dr. Volkan OBAN
 
Python - Rastgele Orman(Random Forest) Parametreleri
Python - Rastgele Orman(Random Forest) ParametreleriPython - Rastgele Orman(Random Forest) Parametreleri
Python - Rastgele Orman(Random Forest) ParametreleriDr. Volkan OBAN
 
Linear Programming wi̇th R - Examples
Linear Programming wi̇th R - ExamplesLinear Programming wi̇th R - Examples
Linear Programming wi̇th R - ExamplesDr. Volkan OBAN
 
"optrees" package in R and examples.(optrees:finds optimal trees in weighted ...
"optrees" package in R and examples.(optrees:finds optimal trees in weighted ..."optrees" package in R and examples.(optrees:finds optimal trees in weighted ...
"optrees" package in R and examples.(optrees:finds optimal trees in weighted ...Dr. Volkan OBAN
 
k-means Clustering in Python
k-means Clustering in Pythonk-means Clustering in Python
k-means Clustering in PythonDr. Volkan OBAN
 
Naive Bayes Example using R
Naive Bayes Example using  R Naive Bayes Example using  R
Naive Bayes Example using R Dr. Volkan OBAN
 
k-means Clustering and Custergram with R
k-means Clustering and Custergram with Rk-means Clustering and Custergram with R
k-means Clustering and Custergram with RDr. Volkan OBAN
 
Data Science and its Relationship to Big Data and Data-Driven Decision Making
Data Science and its Relationship to Big Data and Data-Driven Decision MakingData Science and its Relationship to Big Data and Data-Driven Decision Making
Data Science and its Relationship to Big Data and Data-Driven Decision MakingDr. Volkan OBAN
 
Data Visualization with R.ggplot2 and its extensions examples.
Data Visualization with R.ggplot2 and its extensions examples.Data Visualization with R.ggplot2 and its extensions examples.
Data Visualization with R.ggplot2 and its extensions examples.Dr. Volkan OBAN
 
ReporteRs package in R. forming powerpoint documents-an example
ReporteRs package in R. forming powerpoint documents-an exampleReporteRs package in R. forming powerpoint documents-an example
ReporteRs package in R. forming powerpoint documents-an exampleDr. Volkan OBAN
 
ReporteRs package in R. forming powerpoint documents-an example
ReporteRs package in R. forming powerpoint documents-an exampleReporteRs package in R. forming powerpoint documents-an example
ReporteRs package in R. forming powerpoint documents-an exampleDr. Volkan OBAN
 
R-ggplot2 package Examples
R-ggplot2 package ExamplesR-ggplot2 package Examples
R-ggplot2 package ExamplesDr. Volkan OBAN
 
R Machine Learning packages( generally used)
R Machine Learning packages( generally used)R Machine Learning packages( generally used)
R Machine Learning packages( generally used)Dr. Volkan OBAN
 
treemap package in R and examples.
treemap package in R and examples.treemap package in R and examples.
treemap package in R and examples.Dr. Volkan OBAN
 
imager package in R and examples..
imager package in R and examples..imager package in R and examples..
imager package in R and examples..Dr. Volkan OBAN
 
R-Data table Cheat Sheet
R-Data table Cheat SheetR-Data table Cheat Sheet
R-Data table Cheat SheetDr. Volkan OBAN
 

Mais de Dr. Volkan OBAN (20)

Conference Paper:IMAGE PROCESSING AND OBJECT DETECTION APPLICATION: INSURANCE...
Conference Paper:IMAGE PROCESSING AND OBJECT DETECTION APPLICATION: INSURANCE...Conference Paper:IMAGE PROCESSING AND OBJECT DETECTION APPLICATION: INSURANCE...
Conference Paper:IMAGE PROCESSING AND OBJECT DETECTION APPLICATION: INSURANCE...
 
Covid19py Python Package - Example
Covid19py  Python Package - ExampleCovid19py  Python Package - Example
Covid19py Python Package - Example
 
Object detection with Python
Object detection with Python Object detection with Python
Object detection with Python
 
Python - Rastgele Orman(Random Forest) Parametreleri
Python - Rastgele Orman(Random Forest) ParametreleriPython - Rastgele Orman(Random Forest) Parametreleri
Python - Rastgele Orman(Random Forest) Parametreleri
 
Linear Programming wi̇th R - Examples
Linear Programming wi̇th R - ExamplesLinear Programming wi̇th R - Examples
Linear Programming wi̇th R - Examples
 
"optrees" package in R and examples.(optrees:finds optimal trees in weighted ...
"optrees" package in R and examples.(optrees:finds optimal trees in weighted ..."optrees" package in R and examples.(optrees:finds optimal trees in weighted ...
"optrees" package in R and examples.(optrees:finds optimal trees in weighted ...
 
k-means Clustering in Python
k-means Clustering in Pythonk-means Clustering in Python
k-means Clustering in Python
 
Naive Bayes Example using R
Naive Bayes Example using  R Naive Bayes Example using  R
Naive Bayes Example using R
 
R forecasting Example
R forecasting ExampleR forecasting Example
R forecasting Example
 
k-means Clustering and Custergram with R
k-means Clustering and Custergram with Rk-means Clustering and Custergram with R
k-means Clustering and Custergram with R
 
Data Science and its Relationship to Big Data and Data-Driven Decision Making
Data Science and its Relationship to Big Data and Data-Driven Decision MakingData Science and its Relationship to Big Data and Data-Driven Decision Making
Data Science and its Relationship to Big Data and Data-Driven Decision Making
 
Data Visualization with R.ggplot2 and its extensions examples.
Data Visualization with R.ggplot2 and its extensions examples.Data Visualization with R.ggplot2 and its extensions examples.
Data Visualization with R.ggplot2 and its extensions examples.
 
ReporteRs package in R. forming powerpoint documents-an example
ReporteRs package in R. forming powerpoint documents-an exampleReporteRs package in R. forming powerpoint documents-an example
ReporteRs package in R. forming powerpoint documents-an example
 
ReporteRs package in R. forming powerpoint documents-an example
ReporteRs package in R. forming powerpoint documents-an exampleReporteRs package in R. forming powerpoint documents-an example
ReporteRs package in R. forming powerpoint documents-an example
 
R-ggplot2 package Examples
R-ggplot2 package ExamplesR-ggplot2 package Examples
R-ggplot2 package Examples
 
R Machine Learning packages( generally used)
R Machine Learning packages( generally used)R Machine Learning packages( generally used)
R Machine Learning packages( generally used)
 
treemap package in R and examples.
treemap package in R and examples.treemap package in R and examples.
treemap package in R and examples.
 
Mosaic plot in R.
Mosaic plot in R.Mosaic plot in R.
Mosaic plot in R.
 
imager package in R and examples..
imager package in R and examples..imager package in R and examples..
imager package in R and examples..
 
R-Data table Cheat Sheet
R-Data table Cheat SheetR-Data table Cheat Sheet
R-Data table Cheat Sheet
 

Último

Gartner's Data Analytics Maturity Model.pptx
Gartner's Data Analytics Maturity Model.pptxGartner's Data Analytics Maturity Model.pptx
Gartner's Data Analytics Maturity Model.pptxchadhar227
 
Dubai Call Girls Peeing O525547819 Call Girls Dubai
Dubai Call Girls Peeing O525547819 Call Girls DubaiDubai Call Girls Peeing O525547819 Call Girls Dubai
Dubai Call Girls Peeing O525547819 Call Girls Dubaikojalkojal131
 
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...nirzagarg
 
Harnessing the Power of GenAI for BI and Reporting.pptx
Harnessing the Power of GenAI for BI and Reporting.pptxHarnessing the Power of GenAI for BI and Reporting.pptx
Harnessing the Power of GenAI for BI and Reporting.pptxParas Gupta
 
7. Epi of Chronic respiratory diseases.ppt
7. Epi of Chronic respiratory diseases.ppt7. Epi of Chronic respiratory diseases.ppt
7. Epi of Chronic respiratory diseases.pptibrahimabdi22
 
Capstone in Interprofessional Informatic // IMPACT OF COVID 19 ON EDUCATION
Capstone in Interprofessional Informatic  // IMPACT OF COVID 19 ON EDUCATIONCapstone in Interprofessional Informatic  // IMPACT OF COVID 19 ON EDUCATION
Capstone in Interprofessional Informatic // IMPACT OF COVID 19 ON EDUCATIONLakpaYanziSherpa
 
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...gajnagarg
 
怎样办理圣路易斯大学毕业证(SLU毕业证书)成绩单学校原版复制
怎样办理圣路易斯大学毕业证(SLU毕业证书)成绩单学校原版复制怎样办理圣路易斯大学毕业证(SLU毕业证书)成绩单学校原版复制
怎样办理圣路易斯大学毕业证(SLU毕业证书)成绩单学校原版复制vexqp
 
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样wsppdmt
 
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...nirzagarg
 
怎样办理旧金山城市学院毕业证(CCSF毕业证书)成绩单学校原版复制
怎样办理旧金山城市学院毕业证(CCSF毕业证书)成绩单学校原版复制怎样办理旧金山城市学院毕业证(CCSF毕业证书)成绩单学校原版复制
怎样办理旧金山城市学院毕业证(CCSF毕业证书)成绩单学校原版复制vexqp
 
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...
Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...Bertram Ludäscher
 
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...Klinik kandungan
 
Digital Transformation Playbook by Graham Ware
Digital Transformation Playbook by Graham WareDigital Transformation Playbook by Graham Ware
Digital Transformation Playbook by Graham WareGraham Ware
 
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...Health
 
Vadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book now
Vadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book nowVadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book now
Vadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book nowgargpaaro
 
一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样
一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样
一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样wsppdmt
 

Último (20)

Gartner's Data Analytics Maturity Model.pptx
Gartner's Data Analytics Maturity Model.pptxGartner's Data Analytics Maturity Model.pptx
Gartner's Data Analytics Maturity Model.pptx
 
Dubai Call Girls Peeing O525547819 Call Girls Dubai
Dubai Call Girls Peeing O525547819 Call Girls DubaiDubai Call Girls Peeing O525547819 Call Girls Dubai
Dubai Call Girls Peeing O525547819 Call Girls Dubai
 
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
 
Sequential and reinforcement learning for demand side management by Margaux B...
Sequential and reinforcement learning for demand side management by Margaux B...Sequential and reinforcement learning for demand side management by Margaux B...
Sequential and reinforcement learning for demand side management by Margaux B...
 
Harnessing the Power of GenAI for BI and Reporting.pptx
Harnessing the Power of GenAI for BI and Reporting.pptxHarnessing the Power of GenAI for BI and Reporting.pptx
Harnessing the Power of GenAI for BI and Reporting.pptx
 
7. Epi of Chronic respiratory diseases.ppt
7. Epi of Chronic respiratory diseases.ppt7. Epi of Chronic respiratory diseases.ppt
7. Epi of Chronic respiratory diseases.ppt
 
Capstone in Interprofessional Informatic // IMPACT OF COVID 19 ON EDUCATION
Capstone in Interprofessional Informatic  // IMPACT OF COVID 19 ON EDUCATIONCapstone in Interprofessional Informatic  // IMPACT OF COVID 19 ON EDUCATION
Capstone in Interprofessional Informatic // IMPACT OF COVID 19 ON EDUCATION
 
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
 
怎样办理圣路易斯大学毕业证(SLU毕业证书)成绩单学校原版复制
怎样办理圣路易斯大学毕业证(SLU毕业证书)成绩单学校原版复制怎样办理圣路易斯大学毕业证(SLU毕业证书)成绩单学校原版复制
怎样办理圣路易斯大学毕业证(SLU毕业证书)成绩单学校原版复制
 
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样
如何办理英国诺森比亚大学毕业证(NU毕业证书)成绩单原件一模一样
 
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
 
怎样办理旧金山城市学院毕业证(CCSF毕业证书)成绩单学校原版复制
怎样办理旧金山城市学院毕业证(CCSF毕业证书)成绩单学校原版复制怎样办理旧金山城市学院毕业证(CCSF毕业证书)成绩单学校原版复制
怎样办理旧金山城市学院毕业证(CCSF毕业证书)成绩单学校原版复制
 
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...
Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...Reconciling Conflicting Data Curation Actions:  Transparency Through Argument...
Reconciling Conflicting Data Curation Actions: Transparency Through Argument...
 
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
 
Digital Transformation Playbook by Graham Ware
Digital Transformation Playbook by Graham WareDigital Transformation Playbook by Graham Ware
Digital Transformation Playbook by Graham Ware
 
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get CytotecAbortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
 
Abortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get CytotecAbortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get Cytotec
 
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
 
Vadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book now
Vadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book nowVadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book now
Vadodara 💋 Call Girl 7737669865 Call Girls in Vadodara Escort service book now
 
一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样
一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样
一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样
 

Pandas,scipy,numpy cheatsheet

  • 1. 1 www.quandl.com NumPy / SciPy / Pandas Cheat Sheet Select column. Select row by label. Return DataFrame index. Delete given row or column. Pass axis=1 for columns. Reindex df1 with index of df2. Reset index, putting old index in column named index. Change DataFrame index, new indecies set to NaN. Show first n rows. Show last n rows. Sort index. Sort columns. Pivot DataFrame, using new conditions. Transpose DataFrame. Change lowest level of column labels into innermost row index. Change innermost row index into lowest level of column labels. NumPy / SciPy arr = array([]) arr.shape convolve(a,b) arr.reshape() sum(arr) mean(arr) std(arr) dot(arr1,arr2) vectorize() Create a Series. Create a Dataframe. Create a Panel. Pandas Create Structures s = Series (data, index) df = DataFrame (data, index, columns) p = Panel (data, items, major_axis, minor_axis) df.stack() df.unstack() df.pivot(index,column,values) df.T DataFrame commands df[col] df.iloc[label] df.index df.drop() df1 = df1.reindex_like(df1,df2) df.reset_index() df.reindex() df.head(n) df.tail(n) df.sort() df.sort(axis=1) Create numpy array. Shape of an array. Linear convolution of two sequences. Reshape array. Sum all elements of array. Compute mean of array. Compute standard deviation of array. Compute inner product of two arrays. Turn a scalar function into one which accepts & returns vectors.
  • 2. 2 www.quandl.com Create a time series index.date_range(start, end, freq) Pandas Time Series Business Day Calender day Weekly Monthly Quarterly Annual Hourly B D W M Q A H Freq has many options including: Any Structure with a datetime index Split DataFrame by columns. Creates a GroupBy object (gb). Apply function (single or list) to a GroupBy object. Applies function and returns object with same index as one being grouped. Filter GroupBy object by a given function. Return dict whose keys are the unique groups, and values are axis labels belonging to each group. Groupby groupby() gb.agg() gb.transform() gb.filter() gb.groups Save to CSV. Read CSV into DataFrame. Save to Excel. Read exel into DataFrame. I/O df.to_csv(‘foo.csv’) read_csv(‘foo.csv’) to_excel(‘foo.xlsx’, sheet_name) read_excel(‘foo.xlsx’,’sheet1’, index_col = None, na_values = [‘NA’]) df.dropna() df.count() df.min() df.max() df.describe() concat() Drops rows where any data is missing. Returns Series of row counts for every column. Return minimum of every column. Return maximum of every column. Generate various summary statistics for every column. Merge DataFrame or Series objects. Apply function to every element in DataFrame. Apply function along a given axis. df.applymap() df.apply() Resample data with new frequency.ts.resample()
  • 3. 3 www.quandl.com Select current axis. Change axis color, none to remove. Change axis position. Can change coordinate space. Create legend. Set to ‘best’ for auto placement. Save plot. ax=gca() ax.spines[].set_color() ax.spines[].set_position() Label the x-axis. Label the y-axis. Title the graph. Set tick values for x-axis. First array for values, second for labels. Set tick values for y-axis. First array for values, second for labels. yticks([],[]) Plot data or plot a function against a range. Create multiple plots; n- number of plots, x - number horizontally displayed, y- number vertically displayed. plot() subplot(n,x,y) xlabel() ylabel() title() xticks([],[]) Plotting Matplotlib is an extremely powerful module. See www.matplotlib.org for complete documentation. Quandl is a search engine for numerical data, allowing easy access to financial, social, and demographic data from hundreds of sources. Quandl The Quandl package enables Quandl API access from within Python, which makes acquiring and manipulating numerical data as quick and easy as possible. In your first Quandl function call you should specifiy your authtoken (found on Quandl’s website after signing up) to avoid certain API call limits. See www.quandl.com/help/packages/python for more. savefig(‘foo.png’) legend(loc=’ ‘) Return data for nearest time interval. Return data for specific time. Return data between specific interval. Convert Pandas DatetimeIndex to datetime.datetime object. Conver a list of date-like objects (strings, epochs, etc.) to a DatetimeIndex. ts.ix[start:end] ts[] ts.between_time() to_pydatetime() to_datetime()
  • 4. 4 www.quandl.com Plotting Example import Quandl as q import matplotlib.pyplot as plt rural = q.get(‘WORLDBANK/USA_SP_RUR_TOTL_ZS’) urban = q.get(‘WORLDBANK/USA_SP_URB_TOTL_IN_ZS’) plt.subplot(2, 1, 1) plt.plot(rural.index,rural) plt.xticks(rural.index[0::3],[]) plt.title(‘American Population’) plt.ylabel(‘% Rural’) plt.subplot(2, 1, 2) plt.plot(urban.index,urban) plt.xlabel(‘year’) plt.ylabel(‘% Urban’) plt.show() Add the following to any function call. Download Quandl data for a certain Quandl code as a Dataframe. Search Quandl. Outputs first 4 results. Upload a Pandas DataFrame (with a time series index) to Quandl. Code must be all capital alphanumeric. authtoken = ‘YOURTOKENHERE’ get(‘QUANDL/CODE’) search(‘searchterm’) push(data, code, name)