teadocs / pandas-cn

Pandas中文文档,欢迎贡献!
https://www.pypandas.cn/
927 stars 306 forks source link

10分钟入门Pandas文档错误 #103

Open czqmike opened 3 years ago

czqmike commented 3 years ago

用 [ ] 切片行:


In [24]: df[0:3]
Out[24]: 
A         B         C         D
2013-01-01  0.469112 -0.282863 -1.509059 -1.135632
2013-01-02  1.212112 -0.173215  0.119209 -1.044236
2013-01-03 -0.861849 -2.104569 -0.494929  1.071804

In [25]: df['20130102':'20130104'] Out[25]: A B C D 2013-01-02 1.212112 -0.173215 0.119209 -1.044236 2013-01-03 -0.861849 -2.104569 -0.494929 1.071804 2013-01-04 0.721555 -0.706771 -1.039575 0.271860



**``[]``应该是切片列吧,我试了好久说key错误,找了别的文档才发现方括号是切片列,`loc`才是切片行的。。**