如何将列中每个单词的首字母大写?我顺便使用python pandas.例如,
Column1
The apple
the Pear
Green tea
Run Code Online (Sandbox Code Playgroud)
我的愿望结果将是:
Column1
The Apple
The Pear
Green Tea
Run Code Online (Sandbox Code Playgroud) 刚刚在 Juypter 上启动了 python pandas。我在尝试获取等号后的值时遇到困难。有人能帮我渡过难关吗?
Hi = 123456
123456 (result i wish to get)
Run Code Online (Sandbox Code Playgroud)
我当前的代码返回“ = 123456 ”。
df['column'].str.extract("Hi+\W(.*)",expand= True)
Run Code Online (Sandbox Code Playgroud) 我是pandas python的新手,我在尝试对列中的所有值进行舍入时遇到了困难.例如,
Example
88.9
88.1
90.2
45.1
Run Code Online (Sandbox Code Playgroud)
我尝试使用下面的当前代码,但它给了我:
AttributeError:'str'对象没有属性'rint'
df.Example = df.Example.round()
Run Code Online (Sandbox Code Playgroud) 我在使用其他专栏的数据替换NAT日期时遇到了困难.我顺便使用python pandas.
例如
Column1 Column2
02-12-2006 2006
05-12-2005 2005
NAT 2008
15-02-2015 2015
NAT 2001
Run Code Online (Sandbox Code Playgroud)
我在column1中有有效日期,只有column2中的年份,我如何使用基于同一行的第2列中的年份来估算NAT值.
我的愿望结果将是
Column1 Column2
02-12-2006 2006
05-12-2005 2005
2008 2008
15-02-2015 2015
2001 2001
Run Code Online (Sandbox Code Playgroud) <?php
class PublishersController extends AppController
{
public function index()
{
$this->set("publishers",
$this->Publisher->find("all", array('order' => 'company_name ASC')));
}
public function view($id = null)
{
$this->Publisher->id = $id;
$this->set('publisher', $this->Publisher->read());
}
function edit($id = null)
{
$this->Publisher->id = $id;
if (empty($this->data))
{
$this->data = $this->Publisher->findById($id);
}
else
{
if ($this->Publisher->save($this->data))
{
$this->Session->setFlash('Publisher Updated Successfully');
$this->redirect(array('action' => 'index'));
}
}
}
}
?>
Run Code Online (Sandbox Code Playgroud)