- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我已经查看了很多出现此错误的问题。我正在运行 Pandas “0.10.1”
df = DataFrame({'A' : np.random.randn(5),
'B' : np.random.randn(5),'C' : np.random.randn(5),
'D':['a','b','c','d','e'] })
#gives error
df.take([2,0,1,2,3], axis=1).drop(['C'],axis=1)
#works fine
df.take([2,0,1,2,1], axis=1).drop(['C'],axis=1)
我唯一能看到的是,在前一种情况下,我有非数字列,这似乎以某种方式影响了索引,但下面的命令返回空值:
df.take([2,0,1,2,3], axis=1).index.get_duplicates()
Reindexing error makes no sense似乎不适用,因为我的旧索引是唯一的。
据我所知,使用此问答中的 df.take([2,0,1,2,3], axis=1).index.get_duplicates() 命令,我的索引看起来是独一无二的:problems with reindexing dataframes: Reindexing only valid with uniquely valued Index objects
"Reindexing only valid with uniquely valued Index objects"似乎不适用
我认为我的 pandas version# 没问题,所以这应该不是问题 pandas Reindexing only valid with uniquely valued Index objects
最佳答案
首先,我相信您打算使用以下命令测试重复项:
df.take([2,0,1,2,3],axis=1).columns.get_duplicates()
因为如果您使用索引而不是列,那么它显然会返回一个空数组,因为随机浮点值不会重复。上面的命令按预期返回:
['C']
其次,我认为你是对的,非数字列被扔掉了,因为即使你使用下面的,仍然有错误:
df = DataFrame({'A' : np.random.randn(5), 'B' : np.random.randn(5),'C' :np.random.randn(5), 'D':[str(x) for x in np.random.randn(5) ]})
这可能是一个错误,因为如果您检查名为“index.py”的核心文件,在第 86 行和第 1228 行,它期望的类型是(分别):
_engine_type = _index.ObjectEngine
_engine_type = _index.Int64Engine
如果您更深入地查看文档,那么它们似乎都不需要字符串。这是我得到的最好的,祝你好运!如果您解决了这个问题,请告诉我,因为我也很感兴趣。
关于python - 解决 Reindexing only valid with uniquely valued Index objects,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21533706/
我已经在我的 PostgreSQL 数据库上启动了 REINDEX。在 GUI 中可以看到它处理了一些表,然后停止响应。看起来它仍在工作,即使在两个小时后也是如此。 GUI 没有响应,其最后一行显示:
我已经浏览了几次 _reindex api 文档,但不知道是否可行。将文档从源索引复制到目标索引后,是否也可以删除源文档? 这是我正在调用的当前 _reindex api 调用主体: { "sou
我做不到 重新索引 在 magento 2 .在谷歌之后,我得到了我们可以用 shell 命令重新索引的解决方案 php dev/shell/indexer.php reindexall 但它给出了错
我正在进行一项重新索引 Elasticsearch 索引的任务,以防发生任何更改。我可以找到2种方法来实现此目的,但是除非我缺少某些内容,否则它们对我来说都是相同的。 我正在从服务B的Postgres
我最近决定更改我的映射/设置,为此,我不得不重新索引所有文档(5M),但是,只重新索引了5m中的20个文档。 我用相同的拱形创建了一个新的索引,但是更改了许多映射/设置。 (将关键字类型更改为文本类型
因此,我们处于需要将Elasticsearch文档从一个索引重新索引到另一索引的情况。我们正在为此使用reindex API。尽管有时文档已经存在于目标索引中。设置version_type: "ext
我已经设置了目标索引 new_dest_index在运行 _reindex 之前操作,包括设置映射、分片计数、副本等。 我运行了下面的 POST 命令来从 source_index 复制所有文件至 n
我正在尝试使用reindex API进行Elasticsearch https://www.elastic.co/guide/en/elasticsearch/reference/current/do
我尝试了该主题的几个示例,但没有结果。我正在读取一个 DataFrame,如下所示: Code,Counts 10006,5 10011,2 10012,26 10013,20 10014,17 10
我正在尝试使用以下行重新编制索引: POST _reindex { "source": { "index": "poi_201705" }, "dest": { "inde
这是我正在使用的代码: 将 pandas 导入为 pd test3 = pd.Series([1,2,3], index = ['a','b','c']) test3 = test3.reindex(
我在创建表时创建索引,然后将数据插入表中。 我认为当表中的数据已经被索引时,即使我删除或插入新数据也不需要运行 REINDEX。 这是正确的吗?或者每次,我都需要运行一个 REINDEX。 如果我需要
使用 Magento 1.6 我不得不对我的 catlog 进行一些批量更改,因此做了一个完整的产品导出,进行了更改,然后导入了修改后的文件。 之后有一些索引需要更新,除了“产品属性”索引之外的所有索
我可以搜索显示此错误消息“原因”的建议,但不能搜索如何解决它 - 每次我尝试通过连接 2 个现有列中的字符串值来向 pandas 数据框添加新列时都会遇到此问题。 例如: wind['timestam
包 x.x.x.repository.search 没有成功生成。我该如何解决它。 源代码是here 我只是运行 npm install -g generator-jhipster-elasticse
集成某些产品后,我在重新索引 Magento CMS 时遇到问题。 这是 shell 重新索引的日志 /usr/home/sinusi/public_html/_duplicateshop/shel
我的目标是重新索引具有 1000 万个分片的索引,以更改字段映射以促进重要术语分析。 我的问题是我在使用 NEST 库执行重新索引时遇到问题,并且文档(非常)有限。如果可能的话,我需要一个使用中的例子
假设我有两个数据框: import string import pandas as pd d = {'one': pd.Series(range(26), index = list(string.as
我正在尝试相对于索引的第二级重新索引数据框。我有一个数据框,其中索引的第一级是用户 ID,第二级是日期。例如: pd.DataFrame({ 'id': 3*['A'] + 5*['B'] + 4*[
我正在尝试使用 pandas reindex 函数填充我的时间序列数据中缺失的行。 我的数据如下: 100,2007,239,4,29.588,-30.851,-999.0,-999.0,-999.
我是一名优秀的程序员,十分优秀!