python pandas iloc works on jupyter but not on flask
up vote
-3
down vote
favorite
I am developing an API from flask and for that I had to use pandas in between of a function. So to access a data I used pandas iloc but it shows an error 'IndexError: single positional indexer is out-of-bounds'.
Here's my code:
price = float(cf.loc[cf['company_name'] == 'Agricultural Development Bank Limited', 'Close'].iloc[0])
return price
If I run the same thing at jupyter then it works perfectly.
Cjeck out the screenshot of running this code in jupyter notebook
Please help.
python pandas flask
add a comment |
up vote
-3
down vote
favorite
I am developing an API from flask and for that I had to use pandas in between of a function. So to access a data I used pandas iloc but it shows an error 'IndexError: single positional indexer is out-of-bounds'.
Here's my code:
price = float(cf.loc[cf['company_name'] == 'Agricultural Development Bank Limited', 'Close'].iloc[0])
return price
If I run the same thing at jupyter then it works perfectly.
Cjeck out the screenshot of running this code in jupyter notebook
Please help.
python pandas flask
add a comment |
up vote
-3
down vote
favorite
up vote
-3
down vote
favorite
I am developing an API from flask and for that I had to use pandas in between of a function. So to access a data I used pandas iloc but it shows an error 'IndexError: single positional indexer is out-of-bounds'.
Here's my code:
price = float(cf.loc[cf['company_name'] == 'Agricultural Development Bank Limited', 'Close'].iloc[0])
return price
If I run the same thing at jupyter then it works perfectly.
Cjeck out the screenshot of running this code in jupyter notebook
Please help.
python pandas flask
I am developing an API from flask and for that I had to use pandas in between of a function. So to access a data I used pandas iloc but it shows an error 'IndexError: single positional indexer is out-of-bounds'.
Here's my code:
price = float(cf.loc[cf['company_name'] == 'Agricultural Development Bank Limited', 'Close'].iloc[0])
return price
If I run the same thing at jupyter then it works perfectly.
Cjeck out the screenshot of running this code in jupyter notebook
Please help.
python pandas flask
python pandas flask
edited Nov 19 at 16:56
davidism
61.1k12154173
61.1k12154173
asked Nov 19 at 16:49
Aabishkar Wagle
12
12
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
It's probably trying to index an empty dataframe. For illustration try running this:
df = pd.DataFrame()
df.iloc[0]
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
It's probably trying to index an empty dataframe. For illustration try running this:
df = pd.DataFrame()
df.iloc[0]
add a comment |
up vote
0
down vote
It's probably trying to index an empty dataframe. For illustration try running this:
df = pd.DataFrame()
df.iloc[0]
add a comment |
up vote
0
down vote
up vote
0
down vote
It's probably trying to index an empty dataframe. For illustration try running this:
df = pd.DataFrame()
df.iloc[0]
It's probably trying to index an empty dataframe. For illustration try running this:
df = pd.DataFrame()
df.iloc[0]
answered Nov 19 at 18:26
Robert
34429
34429
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53379242%2fpython-pandas-iloc-works-on-jupyter-but-not-on-flask%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown