# Python Excel Print Colum

**URL:** <https://discuss.streamlit.io/t/python-excel-print-colum/23553>\
**Category:** Using Streamlit\
**Tags:** pandas\
**Created:** [March 26, 2022, 7:05am UTC](https://discuss.streamlit.io/t/python-excel-print-colum/23553 "2022-03-26T07:05:13Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mario\_Andrei](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/mario_andrei/32/14389_2.png) [@Mario\_Andrei](https://discuss.streamlit.io/u/Mario_Andrei)\
**Post date:** [March 26, 2022, 7:05am UTC](https://discuss.streamlit.io/t/python-excel-print-colum/23553/1 "2022-03-26T07:05:13Z")

</div>

Hello,

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 !

---

<div class="post-metadata">

**Author:** ![cualr](https://avatars.discourse-cdn.com/v4/letter/c/ec9cab/32.png) [@cualr](https://discuss.streamlit.io/u/cualr)\
**Post date:** [March 28, 2022, 11:48pm UTC](https://discuss.streamlit.io/t/python-excel-print-colum/23553/2 "2022-03-28T23:48:12Z")

</div>

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  
df=pd.read\_csv(INSERT YOUR FILE PATH HERE)

user\_input=st.text\_input(“User Search”)

if df[“C”].str[1::].str.contains(user\_input).any() and user\_input!="":  
st.write(df[df[“C”].str[1::].str.contains(user\_input)])  
elif df[“C”].str[1::].str.contains(user\_input).any()==False:  
st.write(‘Value not found in Table’)  
else:  
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)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/streamlit/original/3X/c/f/cf4c2ee0d938358f82448c5fe4b9c3c91d7ce19c.svg) [@system](https://discuss.streamlit.io/u/system)\
**Post date:** [March 28, 2023, 11:48pm UTC](https://discuss.streamlit.io/t/python-excel-print-colum/23553/3 "2023-03-28T23:48:56Z")

</div>

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
