Python Forum
Match string return different cell string
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Match string return different cell string
#1
Hello,

Is there a way to search for a string, and once it's found return the value thats 9 cells below it?

This code reads in TFile only column B data. Then it reads in TDetail looks at cell A1 shortens the word, and then makes it a string example AA1150. Then I want to search for TDetail (example AA1150) inside TFile, and once that string is located return the value that is 9 cells below it.

TFile = Row B tons of data TDetail= string example AA1150

Search TTFile for TTDetail once found return value 9 cells below it.

TFile=pd.read_excel(TF, usecols="B")
  
TDetail=pd.read_excel(input_file, usecols="A",nrows=1,header=None,squeeze=True).str.slice(start=28,stop=-2).to_string(index=False).strip()

result=TFile['Name'].str.contains(TDetail)
   
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Parse Nested JSON String in Python rwalde 4 2,858 Sep-08-2022, 10:32 AM
Last Post: rwalde
  Regex find string then return 10 character after it pyStund 6 1,493 Aug-04-2022, 11:26 PM
Last Post: Pedroski55
  String Matching Using python SathiyaBeegam 2 1,723 Feb-05-2022, 06:46 AM
Last Post: SathiyaBeegam
Sad ValueError: could not convert string to float badju 0 4,294 Jul-01-2021, 12:13 AM
Last Post: badju
  Efficient method to find phrase in string Tuxedo 6 2,939 Feb-25-2021, 07:23 PM
Last Post: Tuxedo
  Join each list elements with string in other DF handy88 0 1,519 Feb-09-2021, 07:00 PM
Last Post: handy88
  How to search for specific string in Pandas dataframe Coding_Jam 1 2,415 Nov-02-2020, 09:35 AM
Last Post: PsyPy
  A function to return only certain columns with certain string illmattic 2 2,170 Jul-24-2020, 12:57 PM
Last Post: illmattic
  How to analyze a string, then write to SPSS Twanski94 0 1,261 Jun-16-2020, 08:38 PM
Last Post: Twanski94
  Indirectlty convert string to float in JSON file WBPYTHON 6 5,830 May-06-2020, 12:09 PM
Last Post: WBPYTHON

Forum Jump:

User Panel Messages

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