I assembled a super quick cheatsheet of the most common Pandas, Numpy and Python tasks I tend to do. Let me know if I missed anything important in the comments below!
1 Data Structures1.1 Lists[]1.1.1 List Comprehensions - (do.. for)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #sudo wget https://github.com/shiftkey/desktop/releases/download/release-2.1.0-linux1/GitHubDesktop-linux-2.1.0-linux1.deb | |
| #sudo gdebi GitHubDesktop-linux-2.1.0-linux1.deb | |
| # UPDATE (2021-03-05): Thanks to PaoloRanzi81's comment, the updated code is as follows https://gist.github.com/PaoloRanzi81 | |
| sudo wget https://github.com/shiftkey/desktop/releases/download/release-2.6.3-linux1/GitHubDesktop-linux-2.6.3-linux1.deb | |
| ### Uncomment below line if you have not installed gdebi-core before | |
| # sudo apt-get install gdebi-core | |
| sudo gdebi GitHubDesktop-linux-2.6.3-linux1.deb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| from skimage import color | |
| def fft(length_x,width_y,v,y,image,inner=True): | |
| expVector=np.exp(-2j*np.pi/width_y*(v@y)) if inner else np.exp(-2j*np.pi/length_x*(v@y)) | |
| if inner: | |
| return image @ expVector | |
| else: | |
| return expVector @ image |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import math | |
| import random | |
| def calculateCost(x,y): | |
| return -0.0001*(( | |
| math.fabs( | |
| math.sin(x)*math.sin(y)*math.exp( | |
| math.fabs( | |
| 100 - math.sqrt(x**2+y**2)/math.pi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import math | |
| import random | |
| import numpy | |
| def calculateCost(x,y): | |
| return -0.0001*(( | |
| math.fabs( | |
| math.sin(x)*math.sin(y)*math.exp( | |
| math.fabs( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| DECLARE @Name nvarchar(1000); | |
| DECLARE @Sql nvarchar(1000); | |
| DECLARE @Result int; | |
| IF OBJECT_ID('tempdb..#myTable') IS NOT NULL | |
| DROP TABLE #myTable | |
| CREATE TABLE #myTable( | |
| row INT, | |
| query NVARCHAR(500)) |
NewerOlder