Posts

  plt.xlim() and plt.ylim() :  commands allow you to either zoom or expand the plot or to set the axis ranges to include important values (such as the origin).  numpy . reshape ( a , newshape , order = 'C' ) a is the array, and newshape can be an int or a tuple like (3,2,5) . When you are reshaping, the total number of elements can’t be altered, as explained above. If you are too lazy to calculate the what the remaining of this tuple should look like, you can just put -1 , and Numpy will calculate for you.  for fit_transform()--use this link  Another Link      

Import CSV Analyse and Parse contents

 Reading a csv file: import csv path1='example.txt' #Reading this into a list reader=list(csv.reader(open(path1), delimiter='\t')) #The reader object takes into one list element #treat this list element like a string and split print(reader[1][0].split(' ')) #It breaks into: ['', '2', '98', '3110111288', '205017830', '2', 'firstname', 'middlename', 'lastname', 'M', 'COMN', '1103:GSMC', 'MUMBAI']   # to read individual elements print(recordreader[6]) returns firstname    #Now we can perform operation which splits the characters into individual elements and perform  operation on them for rec in reader: # print(rec) print(len(str(rec))) for i in range(0,4): recordreader=reader[i][0].split(' ') for j in range(0,9): print(recordreader[j])  #Getting these records into a 2-D list- for rec in reader: # print(rec) print(len(rec)) for...