split()得到了意外的关键字参数'expand' [英] split() got an unexpected keyword argument 'expand'

查看:1647
本文介绍了split()得到了意外的关键字参数'expand'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在python2中,我可以从这个熊猫系列中学习

In python2 i could go from this pandas series

        0
0    [a,b,c]

将s.str.split(',',expand = True)放入其中:

with s.str.split(',',expand=True) into this:

  0 1 2

0 a b c

,现在(ipython3)我不能,因为缺少"expand"参数.我该怎么办呢?

and now (ipython3) i cant, because lack of "expand" argument. How I can do it in other way?

推荐答案

您应检查环境的熊猫版本.根据 pandas文档,展开是最近添加的,因此您好像以某种方式退回了版本.

You should check your environment's pandas version. According to the pandas docs, expand was recently added so it looks like you regressed your version somehow.

expand:布尔值,默认为False如果为True,则返回DataFrame/MultiIndex 扩大维度.如果为False,则返回Series/Index.新进 版本0.16.1.

expand : bool, default False If True, return DataFrame/MultiIndex expanding dimensionality. If False, return Series/Index. New in version 0.16.1.

基于

Based on the old docs it looks like you can do the same thing by specifying the return_type='frame' parameter.

这篇关于split()得到了意外的关键字参数'expand'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆