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
| kind: Service | |
| apiVersion: v1 | |
| metadata: | |
| name: basic-ms-service | |
| spec: | |
| type: NodePort | |
| selector: | |
| app: basic-ms | |
| ports: | |
| - name: basic-ms-service |
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
| apiVersion: apps/v1 | |
| kind: Deployment | |
| metadata: | |
| name: basic-ms-deployment | |
| spec: | |
| replicas: 1 | |
| selector: | |
| matchLabels: | |
| app: basic-ms | |
| template: |
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 pandas as pd | |
| import matplotlib | |
| import matplotlib.pyplot as plt | |
| %matplotlib inline | |
| # end date | |
| end_date = dt.datetime(2018, 1, 1) | |
| # start date | |
| start_date = end_date - timedelta(days = 19) |
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 pandas as pd | |
| import matplotlib | |
| import matplotlib.pyplot as plt | |
| %matplotlib inline | |
| weight_kg = np.random.rand(30) | |
| weight_pound = weight_kg * 2.2 | |
| lines = plt.plot(weight_kg,weight_pound) |
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 pandas as pd | |
| import matplotlib | |
| import matplotlib.pyplot as plt | |
| %matplotlib inline | |
| # Dataframe with random integers 1-100 for Age | |
| age = pd.DataFrame(np.random.randint(1,60,size=(20, 1)), columns=list('A')) | |
| # Dataframe with log values (salary) | |
| salary = np.log10(age['A']) |
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
| # All columns will be filled with NaN, replace NaN with zero | |
| df = df.fillna(0) | |
| print df |
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
| # Create dataframe with date as index | |
| # end date | |
| end_date = dt.datetime(2018, 1, 1) | |
| # start date is | |
| start_date = end_date - timedelta(days = 5) | |
| dates = pd.date_range(start_date, end_date) | |
| columns = ['Defects','tasks'] | |
| # Create Dataframe | |
| df = pd.DataFrame(index=dates, columns=columns) |
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
| arr = np.array([[5, 2, 3, 2], [5, 1, 3, 6],[5, 1, 3, 2]]) | |
| # Create Dataframe from Numpy Array | |
| df1 = pd.DataFrame(arr) | |
| # Retrieve first two rows and last two columns | |
| df2 = df1.iloc[0:2,1:3] | |
| print df2 |
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
| print 'loop using ix - deprecated' | |
| for i in range(df1.size): | |
| val = df1.ix[i] | |
| print val | |
| print 'loop using iloc' | |
| for i in range(df1.size): | |
| val = df1.iloc[i] |
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 pandas as pd | |
| import datetime as dt | |
| from datetime import timedelta | |
| a = np.array([100,100,1000,0,0]) | |
| # Create Dataframe from Numpy Array | |
| df1 = pd.DataFrame(a) |
NewerOlder