我有这个名为'dfArrivalDate'的数据框(显示前11行)
arrival_date count
0 2013-06-08 9
1 2013-06-27 8
2 2013-03-06 8
3 2013-06-01 8
4 2013-06-28 6
5 2012-11-28 6
6 2013-06-11 5
7 2013-06-29 5
8 2013-06-09 4
9 2013-06-03 3
10 2013-05-31 3
sortedArrivalDate = transform.sort('arrival_date')
我想在条形图中绘制它们以查看到达日期的计数。我打电话了
sortedArrivalDate.plot(kind = 'bar') [![enter image description here][1]]
但是我将索引作为条形图的行标记。我想我需要使用'xticks'。
sortedArrivalDate.plot(kind = 'bar', xticks = sortedArrivalDate.arrival_date)
但是我遇到了错误:TypeError:无法将类型'Timestamp'与'float'类型进行比较
我尝试了不同的方法。
fig, ax = plt.subplots()
ax.plot(sortedArrivalDate.arrival_date, sortedArrivalDate.count)
这次错误是ValueError:x和y必须具有相同的第一维
我认为这可能只是一个简单的修复,因为我没有太多编写pandas和matplotlib的经验,我可能会在这里错过一个非常简单的事情。关心引导我朝正确的方向发展?感谢。
答案 0 :(得分:1)
IIUC:
@******** Bootstrap Modal - used with Partial Views ************************@
<div id="modal-container" class="modal fade">
<div class="modal-dialog modal-lg">
<div class="modal-content" id="modal-content">
</div>
</div>
</div>
<script type="text/javascript">
$(function () {
// Attach modal-container bootstrap attributes to links with .modal-link class.
// when a link is clicked with these attributes, bootstrap will display the href content in a modal dialog.
$('body').on('click', '.modal-link', function (e) {
e.preventDefault();
$(this).attr('data-target', '#modal-container');
$(this).attr('data-toggle', 'modal');
});
// Attach listener to .modal-close-btn's so that when the button is pressed the modal dialog disappears
$('body').on('click', '.modal-close-btn', function () {
$('#modal-container').modal('hide');
});
//clear modal cache, so that new content can be loaded
$('#modal-container').on('hidden.bs.modal', function () {
$(this).removeData('bs.modal');
});
$('#CancelModal').on('click', function () {
return false;
});
});
/***** Vertically center Bootstrap 3 modals so they aren't always stuck at the top ********/
$(function () {
function reposition() {
var modal = $(this),
dialog = modal.find('.modal-dialog');
modal.css('display', 'block');
// Dividing by two centers the modal exactly, but dividing by three
// or four works better for larger screens.
dialog.css("margin-top", Math.max(0, ($(window).height() - dialog.height()) / 2));
}
// Reposition when a modal is shown
$('.modal').on('show.bs.modal', reposition);
// Reposition when the window is resized
$(window).on('resize', function () {
$('.modal:visible').each(reposition);
});
});
</script>