My goal here is to import the data stored as DataFrame df1 in sheet1 based on the substring.
My DataFrame looks like below:
df:[2 x 8]
ordercode quantity
PMC11-AA1L1FAVWJA 20
PMC21-AA1A1CBVXJA 10
PMP11-AA1L1FAWJJ 5
PMP21-AA1A1FBWJJ 3
PMP23-AA1A1FA3EJ+JA 1
PTP31B-AA3D1HGBVXJ 1
PTC31B-AA3D1CGBWBJA 2
PTP33B-AA3D1HGB1JJ 10
But my desired result should be like
Sheet2_df2:"1C"
ordercode quantity
PMC21-AA1A1CBVXJA 10
PTC31B-AA3D1CGBWBJA 2
Sheet3_df3:"1F"
PMP11-AA1L1FAWJJ 5
PMP21-AA1A1FBWJJ 3
PMC11-AA1L1FAVWJA 20
In excel it is easy by creating a criteria and use IF function. B1: "1C"
=IF(Sheet1!A2=$B$1,Sheet1!A2,"")
and could copy to all cell.
I don't know how to perform this in python. Any solution would be appreciated.