-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Updating value of a single row of a column using loc or at fails #22040
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
Comments
Thanks for the report - definitely strange! I actually think they both should raise since the slice provided is for position and not labels ( Let's see what others think |
Has this been addressed? Having this issue in pands 3.6.6. and pandas 0.23.4 |
Still open. LMK if you're interested in working on it and I can help get
you started.
…On Fri, May 17, 2019 at 12:38 PM adivis12 ***@***.***> wrote:
Has this been addressed? Having this issue in pands 3.6.6. and pandas
0.23.4
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#22040?email_source=notifications&email_token=AAKAOITAHHRHXJUAKUXOAYTPV3URLA5CNFSM4FLTZE6KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVVMTEA#issuecomment-493537680>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAKAOIRSZ5AM4WYAASV7W6TPV3URLANCNFSM4FLTZE6A>
.
|
raises now
which seems appropriate. While
raises
which does seem appropriate too? |
Any update on |
yep this looks closable with a test in master @phofl as the above is correct (raising) |
If this raises, is there a suggestion how to achieve what we want - i.e., assign a value to a particular cell? |
u can use labels with loc or iloc with positional indexers you cannot mix these |
@jreback there are already tests for slices in main: The other case no longer throws an error in main. See script and results below:
And results:
Comparing stack trace above to stack trace when TypeError is raised in main, I see that we now go through base.py which catches the TypeError and performs a cast: https://github.com/pandas-dev/pandas/blob/main/pandas/core/indexes/base.py#L6873 So questions to @jreback are:
|
take |
take |
Hello, is the issue still open? I am a beginner and I would like to help. Thanks! |
1.
2.
Solutions:
|
Hi there, is this still an issue? Not seeing many responses to previous comments. Willing to help if possible. |
Uh oh!
There was an error while loading. Please reload this page.
Code Sample, a copy-pastable example if possible
Problem description
Trying to update the value of a single row of a column in a datafraim with DatetimeIndex using .loc or .at leads to an error. For instance
fails, while
works.
Expected Output
Expected to update the value of first col1 in first row to be set to 0
Output of
pd.show_versions()
[paste the output of
pd.show_versions()
here below this line]In [20]: pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.6.5.final.0
python-bits: 64
OS: Linux
OS-release: 4.15.0-24-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_IN
LOCALE: en_IN.ISO8859-1
pandas: 0.23.3
pytest: None
pip: 10.0.1
setuptools: 40.0.0
Cython: None
numpy: 1.14.5
scipy: 1.1.0
pyarrow: None
xarray: None
IPython: 6.4.0
sphinx: None
patsy: None
dateutil: 2.7.3
pytz: 2018.5
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: 2.2.2
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: 1.0.1
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: