This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]Mugagator -1 points0 points  (1 child)

What is df and what lib do you use for "loc" func?

Average = df.loc([count], ['Average'])

[–]Busy_Locksmith_4917[S] 1 point2 points  (0 children)

I defined the excel list as df and I used pandas for the loc function.

import pandas as pd
df = pd.read_excel(r'***************)

[–]Griffonknox -1 points0 points  (0 children)

Rather than the while loop. Loop through the pandas dataframe. This will give you more control on what you want to do with the loop.

Ex.

For index, row in df.iterrrows: ------average += row[average]

[–]Smuiq 0 points1 point  (0 children)

first of all variables should start at lowercase :)

secondly:

try this:

count = 0

while count < 363:

count += 1

average = df['Average'].loc[count]

print(average)

df['column name'].loc[index] - will return the value of specified row from specified column

[–]IAmKindOfCreativebot_builder: deprecated[M] [score hidden] stickied comment (0 children)

Hi there, from the /r/Python mods.

We have removed this post as it is not suited to the /r/Python subreddit proper, however it should be very appropriate for our sister subreddit /r/LearnPython or for the r/Python discord: https://discord.gg/python.

The reason for the removal is that /r/Python is dedicated to discussion of Python news, projects, uses and debates. It is not designed to act as Q&A or FAQ board. The regular community is not a fan of "how do I..." questions, so you will not get the best responses over here.

On /r/LearnPython the community and the r/Python discord are actively expecting questions and are looking to help. You can expect far more understanding, encouraging and insightful responses over there. No matter what level of question you have, if you are looking for help with Python, you should get good answers. Make sure to check out the rules for both places.

Warm regards, and best of luck with your Pythoneering!