Employee list in python

employees=[[1,’John’,’Admin’,’Manager’],[2,’Michael’,’Finance’,’Clerk’],[3,’Tom’,’Marketing’,’Supervisor’]] for emp in employees:     print(emp) Output [1, ‘John’, ‘Admin’, ‘Manager’][2, ‘Michael’, ‘Finance’, ‘Clerk’][3, ‘Tom’, ‘Marketing’, ‘Supervisor’]

One dimension array in Python

import array values = array.array(‘i’,[11,22,33,44,55,66]) print(‘Array: ‘,values) arr = array.array(‘i’) for i in range(6):     val = int(input(‘Enter value: ‘))    arr.append(val) print(arr) Output Array: array(‘i’, [11, 22, 33, 44, 55, 66])Enter value: 1Enter value: 2Enter value: 3Enter value: 4Enter value: 5Enter value: 6array(‘i’, [1, 2, 3, 4, 5, 6])

Dataframe column values

import pandas as pd # Create data frame from csv filedf=pd.read_csv(“e://data/state-population.csv”) # Dataframe column values  df[[‘year’, ‘population’]].head() # Dataframe column valuesdf.values Output array([[‘AL’, ‘under18’, 2012, 1117489.0], [‘AL’, ‘total’, 2012, 4817528.0], [‘AL’, ‘under18’, 2010, 1130966.0], …, [‘USA’, ‘total’, 2011, 311582564.0], [‘USA’, ‘under18’, 2012, 73708179.0], [‘USA’, ‘total’, 2012, 313873685.0]], dtype=object)   year 0 2012 1117489.0 1 2012 4817528.0Continue reading “Dataframe column values”