腾讯云
开发者社区
文档
建议反馈
控制台
登录/注册
首页
学习
活动
专区
圈层
工具
MCP广场
文章/答案/技术大牛
搜索
搜索
关闭
发布
文章
问答
(9999+)
视频
沙龙
0
回答
Pandas
:
使用
python
map
()
意外
输出
数据类型
python
、
python-3.x
、
pandas
、
dictionary
我在
pandas
.Dataframe上
使用
map
()。我正在尝试将字符串映射到某个特定的整数。entailment': 0, 'neutral': 1, 'contradiction': 2}在上面的过程中哪里
浏览 0
提问于2018-07-12
得票数 0
2
回答
pandas
-将df.index从float64更改为unicode或字符串
python
、
pandas
、
indexing
、
dataframe
、
rows
我以为这能行得通,但显然不行:type(df.index) df.index = df.index.astype(unicode)TypeError: Setting <class '
pandas
.core.index.Float64Index
浏览 5
提问于2016-02-13
得票数 71
回答已采纳
1
回答
用PyArrow编写Parquet地图
数据类型
python
、
pyarrow
、
apache-arrow
我用
Python
编写,希望
使用
PyArrow生成Parquet文件。因此,我在
Python
/PyArrow中
使用
了几种不同的方法进行了测试。但他们都失败了。:.key_value:col2 = foo .key_value:col2
浏览 10
提问于2020-10-06
得票数 0
1
回答
使用
apply在
pandas
中添加多个列
python
、
pandas
、
dataframe
我正在尝试对数据帧中的一列运行函数(row_extract),该函数返回三个值,然后我想将它们添加到三个新列中。 我试过这样运行它 all_data["substance", "extracted name", "name confidence"] = all_data["name"].apply(row_extract) 但是我得到一个包含所有三个值的列。我将遍历行,但这似乎不是一个非常有效的系统-有什么想法吗? 这是我目前的解决方案,但它需要一段时间。 for index, row in all_data.iterrows(
浏览 27
提问于2020-04-23
得票数 2
3
回答
如何修复“
pandas
.compat”在
python
3中没有属性“string_types”错误
python
、
python-3.x
、
pandas
我正在看教程,在那里我试图
使用
获取股票数据。在请求数据时,您可以选择
数据类型
,我选择了“熊猫”。我正在
使用
python
3.7。我已经卸载和重新安装iexfinance和熊猫。我还创建和IEX云帐户,并传递了一个密匙,如文档声明,但同样的错误。calculationPrice closechangePercent -0.00298我收到的
输出
是/base.py"
浏览 1
提问于2019-08-02
得票数 4
回答已采纳
2
回答
数据帧模式函数
python
、
pandas
、
dataframe
嗨,我想问一下,我正在
使用
df.mode()函数来查找一行中最常见的。这会给我一个额外的列,我怎么会只有一列呢?我正在
使用
df.mode(axis=1),例如,我有一个数据帧 0 1 2 3 42 0 1 0 0 1 2
浏览 7
提问于2020-09-11
得票数 0
1
回答
有没有办法将用zlib创建的字节类型上传到?
arrays
、
google-bigquery
、
zlib
下面是
使用
zlib生成数据的示例代码:import
pandas
as pd df = pd.DataFrame() df, table, job_config=job_config pyarrow.lib.ArrowInvalid: Got
浏览 13
提问于2022-05-13
得票数 0
1
回答
当我
使用
df.append填充数据框时,我放置了0的列被存储为浮点型而不是整型
python
我有一个
使用
df.append填充数据帧的循环。当我打印DF时,用0或1填充的列显示为浮点数,如何将它们存储为整数?
浏览 2
提问于2021-05-09
得票数 0
1
回答
为什么在
Pandas
中调用apply函数时更改了
数据类型
?
python
、
pandas
在
使用
apply函数处理DataFrame时,
意外
地更改了列的
数据类型
。我该怎么做才能防止这种情况发生?例如:Out[9]:score float64将tmp[
浏览 1
提问于2016-10-29
得票数 0
回答已采纳
1
回答
PySpark:带有标量
Pandas
的无效returnType
apache-spark
、
pyspark
、
apache-arrow
from pyspark.sql.functions import
pandas
_udfimport numpy as np 116 except TypeError: 65 C:\opt\spark\spark-2.3.0-bin-
浏览 2
提问于2018-03-26
得票数 5
回答已采纳
1
回答
格式化
Pandas
/
Python
中连接的列。
python
、
excel
、
pandas
我对
Python
/
Pandas
非常陌生,我正在通过Anaconda发行版
使用
Python
发行版
使用
Python
/
Pandas
,.I正在通过下面的代码导入一个Excel文件,并想知道如何获得如下
输出
:目前,Excel中的
输出
格式如下:(另外,我所调用的第二列-阶段,是一个个位数。我
使用
以下资源构建了代码: 下面是我正在
使用
的
浏览 3
提问于2017-10-04
得票数 3
1
回答
不能用
Pandas
以有效的日期格式写入Excel工作表
python
、
excel
、
pandas
、
dataframe
背景:2 .将
输出
作为一个新工作表附加到我现有的excel文件中。下面是我的代码: db = cx_Oracle.connect('*****', '*******','***
浏览 1
提问于2019-10-30
得票数 3
1
回答
如何
使用
pySpark将
数据类型
从字符串转换为整数?
python
、
apache-spark
、
pyspark
我试图将csv文件的字符串列(yr_built)转换为Integer
数据类型
(yr_builtInt)。我尝试过
使用
"cast()“方法。但我仍然有一个错误:从pyspark.sql.types导入IntegerType从pyspark.sql.functions import house5=house4.withColumn("yr_builtInt",col("yr_built").cast(IntegerType))
浏览 4
提问于2022-09-25
得票数 0
回答已采纳
1
回答
更改
Pandas
中的索引类型
python
、
python-3.x
、
pandas
、
indexing
、
data-science
我正在
使用
Python
3中的
Pandas
, 我有一个数据帧,它的索引类似于'20160727',但
数据类型
是'object‘。 我正在尝试将其转换为字符串类型。我试过了: data.index.astye(str, copy=False) 和data.index = data.index.
map
(str) 但即使在这两次手术之后, 我得到了: data.index.dtypeis dtype('O') 我想在将索引转换为字符串后
使用
排序
浏览 22
提问于2019-05-30
得票数 1
3
回答
使用
.loc在熊猫细胞中插入一组不一致行为
python
、
pandas
这是一个很简单的例子df =
pandas
.DataFrame()df.loc[0, 'col2'] = value_to_be_set
输出
0 1 {1}为什么两列的
数据类型
不同?<em
浏览 10
提问于2020-06-11
得票数 8
回答已采纳
2
回答
从Spark
Python
到
Pandas
的时间戳往返
python
、
pandas
、
apache-spark
、
timestamp
如何实现时间戳数据从Spark
Python
到
Pandas
的往返转换?我从Spark中的Hive表中读取数据,希望在
Pandas
中进行一些计算,然后将结果写回Hive。只有最后一部分失败了,将
Pandas
时间戳转换回Spark DataFrame时间戳。2017-03-09 20:00:00')string_date_rdd = sc.parallelize(dates) timestamp_date_rdd = string_date_rdd.
map
|next Thursday|1489
浏览 14
提问于2017-03-04
得票数 7
2
回答
基于JSON列表创建新列
python
、
json
、
pandas
、
string
、
dataframe
(lambda x: x['city']) 3911 self, method="
map
" /opt/anaconda3/lib/
python
3.8&
浏览 0
提问于2021-09-14
得票数 1
1
回答
大熊猫货币的代表与舍入
python
、
numpy
、
pandas
使用
Python
/Numpy中的货币数据,由于小数的浮点表示,我正在经历“
意外
”的舍入行为。如何用
Python
表示数字以实现“十进制风格”四舍五入?我见过十进制模块和货币包,但我不知道如何在
Pandas
数据帧中有效地
使用
它们。解决方案:from decimal import Decimal def float2dec(value):(float2dec) * float2d
浏览 2
提问于2016-01-08
得票数 4
回答已采纳
2
回答
Pandas
TypeError:'float‘类型的对象没有len()
python
、
pandas
我正在
使用
Python
/
Pandas
进行一些数据发现。 File "C:\
Python
35\lib\site-packages\
pandas
\core\series.py", line 2996, in
map
File "C:\
Python
35\lib\sit
浏览 996
提问于2018-07-22
得票数 1
回答已采纳
1
回答
Python
map
()函数
输出
到
Pandas
DataFrame
python
、
pandas
我利用
python
的
map
()函数将参数传递给交易模型并
输出
结果。我
使用
itertools.product查找两个参数的所有可能组合,然后将组合传递给我的名为"run“的函数。函数运行返回返回的
pandas
数据帧。列标题是两个参数和回报的sharpe比率的元组。Pool()功能在所有8个内核上运行
map
():global DF3test1 =pool.<em
浏览 2
提问于2011-12-10
得票数 1
点击加载更多
热门
标签
更多标签
云服务器
ICP备案
实时音视频
对象存储
云直播
活动推荐
运营活动
广告
关闭
领券