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

SettingwithCopyWarning #1

Open
Salocinz opened this issue Oct 21, 2019 · 3 comments
Open

SettingwithCopyWarning #1

Salocinz opened this issue Oct 21, 2019 · 3 comments

Comments

@Salocinz
Copy link

Hey,

I have tried to compile your code but there is the following error:

C:/Users/admin/Desktop/test/unbenannt4_alt.py:252: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
order['Tax Percentage'][order['Journey Type'] == 'Domestic'] = 0
C:/Users/admin/Desktop/test/unbenannt4_alt.py:63: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
route['Warehouse Cost'][route['Warehouse Cost'].isnull()] = bigM
C:/Users/admin/Desktop/test/unbenannt4_alt.py:268: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame

See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
m.set_param(route, order)

Can you help me solve this?

Thanks a lot in advance!

@Rayeedul
Copy link

Rewrite the line as:

order.loc[order.JourneyType == 'Domestic', 'TaxPercentage'] = 0

I hope that works!!

@mahimarathi
Copy link

AttributeError: 'DataFrame' object has no attribute 'JourneyType'
After making those changes this is the error

@decade9
Copy link

decade9 commented May 31, 2022

How to solve this problem? thanks

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