Python Excel Print Colum


Colum A B C D
index1 X1Q S1E F1T G1U
Index2 X2Q S2E F2T G2U
index3 X3Q S3E F3T G3U

Can you guys help me with this ?

import pandas as pd

df= pd.read_excel(file_path)

U = User_Input

#streamlit-examples : If U == 2T or 3T print(index)

I want to only search in colum ‘C’ , and ignore the first letter ’ F "

Output should be:

Index2 X2Q S2E F2T G2U
index3 X3Q S3E F3T G3U

Thank you !

I am unsure if you were looking for a drop down of if the user would type their search. In this case they can type “2T” or “3T” and it would show only their user info and if they type “T” it would show all of the other users info.

import streamlit as st
import pandas as pd

user_input=st.text_input(“User Search”)

if df[“C”].str[1::].str.contains(user_input).any() and user_input!="":
elif df[“C”].str[1::].str.contains(user_input).any()==False:
st.write(‘Value not found in Table’)
st.write(“Please make a selection”)

If what you wanted was a match for the last 2 letters, then that can be fixed with a drop down or just change “contains” to “match” like the example below:

df[“C”].str[1::].str.contains(user_input) → df[“C”].str[1::].str.match(user_input)