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

Slice DataMatrix-- get a view #42

Closed
wesm opened this issue May 1, 2011 · 1 comment
Closed

Slice DataMatrix-- get a view #42

wesm opened this issue May 1, 2011 · 1 comment

Comments

@wesm
Copy link
Member

wesm commented May 1, 2011

add copy keyword to .xs() method. Won't work with DataFrame, should raise Exception

@wesm
Copy link
Member Author

wesm commented May 30, 2011

This can be done now in DataMatrix:

In [8]: dm
Out[8]: 
                       A           B           C           D           
2000-01-03 00:00:00    0.6304     -1.382      -0.242      -1.268      
2000-01-04 00:00:00    0.8243     -0.7684      0.177       0.8974     
2000-01-05 00:00:00    0.9411     -1.207       0.5106      0.9171     
2000-01-06 00:00:00   -2.778       0.9804     -0.4023      0.8694     
2000-01-07 00:00:00    0.09416    -0.4447     -1.29        0.9119     
2000-01-10 00:00:00    0.1413     -0.09031    -2.086       0.5024     
2000-01-11 00:00:00    0.1153     -0.6895     -0.06137     0.4239     
2000-01-12 00:00:00   -1.076      -1.304      -0.01166    -0.3801     
2000-01-13 00:00:00    0.5593     -0.8308     -1.671      -0.4757     
2000-01-14 00:00:00   -0.7621      0.04529     0.8069      0.2096     


In [9]: dm.xs(dm.index[5], copy=False)[:] = 10

In [10]: dm
Out[10]: 
                       A           B           C           D           
2000-01-03 00:00:00    0.6304     -1.382      -0.242      -1.268      
2000-01-04 00:00:00    0.8243     -0.7684      0.177       0.8974     
2000-01-05 00:00:00    0.9411     -1.207       0.5106      0.9171     
2000-01-06 00:00:00   -2.778       0.9804     -0.4023      0.8694     
2000-01-07 00:00:00    0.09416    -0.4447     -1.29        0.9119     
2000-01-10 00:00:00    10          10          10          10         
2000-01-11 00:00:00    0.1153     -0.6895     -0.06137     0.4239     
2000-01-12 00:00:00   -1.076      -1.304      -0.01166    -0.3801     
2000-01-13 00:00:00    0.5593     -0.8308     -1.671      -0.4757     
2000-01-14 00:00:00   -0.7621      0.04529     0.8069      0.2096     

Not possible (yet) in DataFrame, but on the todo list in the fancy indexing category

@wesm wesm closed this as completed May 30, 2011
@blenq blenq mentioned this issue Nov 6, 2021
3 tasks
@MrSiuol MrSiuol mentioned this issue May 2, 2023
3 tasks
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

1 participant