我有两个带有timestamp和value列的pandas数据帧,如下所示:
timestamp value1
0 2015-01-01T15:41:10.500Z 9239.337890625
1 2015-01-01T15:41:50.543Z 9539.337890625
2 2015-01-01T15:42:30.600Z 8957.0458984375
3 2015-01-01T15:43:00.606Z 8237.0458984375
我尝试使用pandas.concat将它们组合在一起
df_all = pd.concat([df1, df2, df3, ...], ignore_index = True)
df_all.sort_values(by='timestamp', inplace = True)
它可以满足我的要求,但是结果包含类似这样的值:
value1 value2 timestamp
133 9587.165039 NaN 2015-01-18T00:00:00.000Z
0 NaN 0.14 2015-01-18T00:00:00.000Z
具有相同的时间戳。如何加入这些行,使其成为:
value1 value2 timestamp
9587.165039 0.14 2015-01-18T00:00:00.000Z
任何建议或评论都将受到高度赞赏。
答案 0 :(得分:0)
import { Switch, Route, Link } from 'react-router-dom';
class Navigation extends Component {
render() {
return (
<div>
<div>
<Navbar>
<Navbar.Brand as={Link} to="/" >React-Bootstrap</Navbar.Brand>
<Navbar.Collapse>
<Nav className="mr-auto">
<NavItem eventkey={1} href="/">
<Nav.Link as={Link} to="/" >Home</Nav.Link>
</NavItem>
</Nav>
<Form inline>
<FormControl type="text" placeholder="Search" className="mr-sm-2" />
<Button variant="outline-success">Search</Button>
</Form>
</Navbar.Collapse>
</Navbar>
</div>
<div>
<Switch>
<Route exact path='/' component={Home} />
<Route render={function () {
return <p>Not found</p>
}} />
</Switch>
</div>
</div>
);
}
}
不会填补空白。您需要对DataFrame执行concat
。
要合并多个DF,我总是这样做:
merge
继续。.