Python中文
首页
教程
问答
标签
搜索
登录
注册
Pandas,TypeError:需要整数(get type str)
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>我正在尝试筛选我的专栏新日期。在</p> <pre><code>0 2019-11-20 1 2019-11-18 2 2019-11-16 3 2019-11-13 4 2019-11-11 5 2019-11-10 6 2019-11-08 7 2019-11-06 8 2019-11-02 9 2019-11-01 10 2019-10-30 11 2019-10-28 12 2019-10-26 13 2019-10-01 14 NaT 15 NaT 16 2019-10-18 17 2019-10-13 18 2019-10-10 19 2019-10-08 20 NaT 21 NaT filterdate = datetime.date(input()) d1 = d1[(d1['New_Date'] > '{filterdate}') & (d1['New_Date'] != 'NaT')] </code></pre> <p>我以“2019-11-11”格式输入我的日期</p> <p>我得到了这个<code>TypeError: an integer is required (got type str)</code></p> <p>任何帮助都将不胜感激。在</p>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>如果我理解正确,您可以尝试:</p> <pre><code>filterdate = input("Input Date in format ((Year-Month-Day): ") d1[(d1['Date'] > filterdate) & (d1['Date'] != 'NaT')] </code></pre> <p>输入“2019-11-11”,不加引号(使用您另一篇文章的数据)</p> ^{pr2}$
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
为什么在使用strptime时会出现未进行转换的数据错误?
10 回答
为什么在使用strptim时会出现这个datetime日期错误
10 回答
为什么在使用StyleFrame时索引列的标题不显示sf.至excel()?
8 回答
为什么在使用sum()函数时会发生“int”对象不可调用的错误?
2 回答
为什么在使用sympy.dsolve时会得到“'list'对象没有属性'func'”?
2 回答
为什么在使用tabla时会得到一个空的数据帧?
10 回答
为什么在使用tensorboard时需要add_graph()的第二个参数?
4 回答
为什么在使用TensorFlow Lite转换YOLOv4时,推断时间/大小没有改进?有什么可能的改进吗?
3 回答
为什么在使用Tensorflow加载训练批时会出现内存泄漏?
10 回答
为什么在使用tensorflow时会收到警告/错误(使用函数API,但未实现错误)
10 回答
为什么在使用tetpyclient发出POST请求时出现403错误?
1 回答
为什么在使用TextBlob时会出现HTTP错误?
1 回答
为什么在使用TFIDF时出现错误“IndexError:list index out of range”pyspark.ml.feature?
6 回答
为什么在使用timedelta格式化之后,我在python中的日期是错误的?
6 回答
为什么在使用timeit或exec函数时,函数中的变量不会在提供的全局命名空间中搜索?
2 回答
为什么在使用tkinter时不能使用复选框?
4 回答
为什么在使用todoistpythonapi时会返回这个奇怪的ID?
1 回答
为什么在使用TQM时,在调整图像大小时,处理时间会有很大的差异?
5 回答
为什么在使用Tweepy下载用户时间线时收到错误消息
8 回答
为什么在使用twitter帐户登录Django应用程序时重定向127.0.0.1:8000?
4 回答