过滤列,然后更换值
我有一个大的数据框,我正在尝试过滤某些包含某个短语的列,即('bps')。我希望从原始数据集中过滤这些列,然后进行计算(除以10000),然后将其替换回原始数据集。
我最初能够通过以下列过滤这些列,但无法将其附加到原始数据集。关于完成此操作的其他方法有什么建议吗?当时正在考虑执行功能,但正在考虑最干净的方法。
raw = raw.filter(喜欢='bps',轴= 1) / 10000
I have a large dataframe in which I'm trying to filter certain columns that contain a certain phrase, IE ('bps'). I'm looking to filter out those columns from the original dataset and then look to perform a calculation (divide by 10000), and then replace it back to the original dataset.
I had originally been able to filter the columns by the below, but not able to append it to the original dataset. Any suggestions on other ways of completing this? Was thinking of doing a function but was thinking the most clean way to do it.
raw = raw.filter(like = 'BPS', axis = 1) / 10000
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你可以做:
或
You can do:
or