简体   繁体   English

如何在python pandas中将周、月转换为天?

[英]How to convert weeks,months into days in python pandas?

The dataset is of hotel and there is a column name "calender updated".Below are the values in this column.Can Anybody help to convert months into days?数据集是酒店的,有一个列名“日历更新”。以下是此列中的值。有人可以帮助将月转换为天吗?

array(['2 months ago', '12 months ago', 'yesterday', 'today',
       '5 weeks ago', 'a week ago', '3 days ago', '3 months ago',
       '4 months ago', '4 days ago', '2 weeks ago', '6 months ago',
       '7 months ago', '1 week ago', '3 weeks ago', '5 months ago',
       '2 days ago', '18 months ago', '11 months ago', '14 months ago',
       '4 weeks ago', '6 weeks ago', '8 months ago', 'never',
       '15 months ago', '6 days ago', '10 months ago', '7 weeks ago',
       '5 days ago', '16 months ago', '9 months ago', '13 months ago',
       '20 months ago', '19 months ago', '17 months ago', '21 months ago',
       '22 months ago', '29 months ago', '25 months ago', '24 months ago',
       '54 months ago', '27 months ago', '39 months ago', '30 months ago',
       '37 months ago', '44 months ago', '23 months ago', '28 months ago',
       '35 months ago', '47 months ago', '42 months ago', '40 months ago',
       '43 months ago', '52 months ago', '50 months ago', '32 months ago',
       '46 months ago', '34 months ago'], dtype=object)

Welcome to Stack Overflow.欢迎使用堆栈溢出。 When you have a chance, take a look at the help pages to see how to format your question to increase the chances that someone will be able to help you.有机会时,请查看帮助页面,了解如何设置问题的格式以增加有人能够帮助您的机会。

How to convert weeks,months into days in python pandas?如何在python pandas中将周、月转换为天?

Take a look at the dateparser module.看看dateparser模块。 I think this will do precisely what you're looking for.我认为这将完全符合您的要求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM