Skip to content

BUG: loc indexing when starting with an empty frame #6252

Closed
@jreback

Description

@jreback

from ML: https://groups.google.com/forum/#!topic/pydata/P3JFE3sob1U
empty indexing the frame

keys1 = ['@' + str(i) for i in range(1000)]
val1 = arange(1000)

keys2 = ['@' + str(i) for i in range(990)]
val2 = arange(990)

allKeys = list(set(keys1).union(keys2))
df = pandas.DataFrame(index = allKeys)
df['A'] = nan
df.loc[keys1, 'A'] = val1

df['B'] = nan
df.loc[keys2, 'B'] = val2

df.head()

## -- End pasted text --
                        <43>
        A    B
@679  679  679
@678  678  678
@337  337  337
@744  744  744
@673  673  673

Metadata

Metadata

Assignees

Labels

BugIndexingRelated to indexing on series/frames, not to indexes themselves

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions