I am trying to fetch values from an excel file using pandas dataframe and print out the values of each cells.
Im using read_excel()
to populate the dataframe, and
I am looking for specific rows using the following line of code:
df.loc[df['Parcel_ID'] == parcel]
parcel being an arbitrary input from the user. And I simply use this to print out the cells:
row = df.loc[df['Parcel_ID'] == parcel]
print row['Category']
print row['Sub_Category']
.
.
(more values)
What I want is only the values from the cells, yet I get dtypes, names of the column, and other junks that I don't want to see. How would I only print out the value from each cells?
If you have several values in your row you could use following:
row['Category'].values.tolist()
row['Sub_Category'].values.tolist()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With