Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

append method is deprecated #43

Open
solareklips opened this issue Nov 10, 2022 · 3 comments
Open

append method is deprecated #43

solareklips opened this issue Nov 10, 2022 · 3 comments

Comments

@solareklips
Copy link

I get this error

FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.
final_dataframe = final_dataframe.append(

Have tried several things now with the pd.concat without luck. It's in "Looping Through The Tickers in Our List of Stocks"

final_dataframe = pd.DataFrame(columns = my_columns) for stock in stocks["Ticker"][:4]: api_url = f"https://sandbox.iexapis.com/stable/stock/{stock}/quote/?token={IEX_CLOUD_API_TOKEN}" data = requests.get(api_url).json() final_dataframe = final_dataframe.append( pd.Series([symbol, data['latestPrice'], data['marketCap'], 'N/A'], index = my_columns), ignore_index = True)

@reyrocket
Copy link

reyrocket commented Nov 13, 2022

It is not an error.
It is a warning.
Your code will still work.
if you don't want to get the warning.
put this at the top of your code
import warnings
warnings.filterwarnings(action='ignore', category=FutureWarning)

@npomfret
Copy link

npomfret commented Jan 6, 2023

It is just a warning. But you can achieve the same outcome without a warning by using pd.concat(... and passing in a 1-row data frame, eg:

new_row = pd.DataFrame([[symbol, price, market_cap, 'N/A']], columns=my_columns)
df = pd.concat([df, new_row], ignore_index=True)

@Nozipho1
Copy link

with this method how do you name the index or make it equal to my_columns?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants