Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
def function
#10
(Jul-23-2020, 05:26 PM)jefsummers Wrote: Still a problem in your if statement - whether true or false it just progresses to the next line and assigns the value to TA.

Personally, I would read the sheet into a Pandas dataframe and use iloc in a loop to find the values, then simply add 9 when found and print that value.

Alternatively, look at using iterrows such as in the article here

I ended up reading it in with Pandas. I'm able to find the string inside the train file. How at this point would I add 9 rows now that the string has been found?

   train_file= pd.read_excel(Train,usecols = 'B')
   string=ws1['A1'].value[28:][:4]
   train_file[train_file['Name'].str.match(string,na=False)]
Reply


Messages In This Thread
def function - by Kristenl2784 - Jul-22-2020, 06:06 PM
RE: def function - by Larz60+ - Jul-22-2020, 06:21 PM
RE: def function - by jefsummers - Jul-22-2020, 06:31 PM
RE: def function - by Kristenl2784 - Jul-22-2020, 06:36 PM
RE: def function - by jefsummers - Jul-22-2020, 07:02 PM
RE: def function - by Kristenl2784 - Jul-22-2020, 08:12 PM
RE: def function - by jefsummers - Jul-23-2020, 01:06 AM
RE: def function - by Kristenl2784 - Jul-23-2020, 11:40 AM
RE: def function - by jefsummers - Jul-23-2020, 05:26 PM
RE: def function - by Kristenl2784 - Jul-23-2020, 05:55 PM
RE: def function - by Kristenl2784 - Jul-23-2020, 06:58 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020