Python, Pandas - How can I get something printed in a data range?
<p>I suppose to create a function that allows user pick a range and it will print out the number within the range. however, I keep getting empty DataFrame with my code. can anyone help me? </p>

<p>`   import pandas as pd</p>

<pre><code>if __name__ == "__main__":   
file_name = "sales_rossetti.xlsx"    

# Formatting numbers (e.g. $1,000,000)
pd.options.display.float_format = '${:,.0f}'.format

# Reading Excel file
df = pd.read_excel(file_name, index_col = 0, convert_float = False)
print ("Welcome to Rossetti's Sales program\n")  
print ("1) Search by State")
print ("2) Search by Jan Sales")
print ("3) Search by Q2 sales")
print ("4) Exit")

my_option = input ("Please select a menu option:")


if (my_option=="2"):
    my_columns = ["Name", "City", "State", "Jan"]
    your_sales = input("please enter the minimum sale: ")
    your_sales = input("please enter the maxium sale: ")
    print (df[my_columns][df.Jan&gt;int(your_sales)][df.Jan&lt;int(your_sales)])`
</code></pre>

<p>You're overwriting the <code>your_sales</code> variable as you're reusing it, so you should use a different variable name for the min and max params. You then need to generate a proper boolean mask using <code>loc</code> and enclosing your boolean conditions using parentheses and <code>&amp;</code> to <code>and</code> the array of boolean values:</p>

<pre><code>if (my_option=="2"):
    my_columns = ["Name", "City", "State", "Jan"]
    min_sales = input("please enter the minimum sale: ")
    max_sales = input("please enter the maxium sale: ")
    print (df.loc[(df.Jan &gt; int(min_sales) ) &amp; (df.Jan &lt; int(max_sales)), my_columns])
</code></pre>

<p>the above should work</p>

python pandas dataframe