Skip to content

QST: how to pandas fast nested for loop for "non numeric" columns? #59824

@ganbaaelmer

Description

@ganbaaelmer

Research

  • I have searched the [pandas] tag on StackOverflow for similar questions.

  • I have asked my usage related question on StackOverflow.

Link to question on StackOverflow

https://stackoverflow.com/questions/78992395/how-to-pandas-fast-nested-for-loop-for-non-numeric-columns

Question about pandas

"""
input:

df1:
name rpm power
0 John 1500 high+
1 Mary 1400 high-
2 Sally 300 low-
3 Doe 700 medium-
4 July 1000 medium+

df2:
name age
0 Peter 77
1 Sally 44
2 Micky 22
3 Sally 34
4 July 50
5 Bob 20

required output is:

but i want it df2:
name age rpm power
0 Peter 77 0 NA
1 Sally 44 300 low-
2 Micky 22 0 NA
3 Sally 34 300 low-
4 July 50 1000 medium+
5 Bob 20 0 NA
"""

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs TriageIssue that has not been reviewed by a pandas team memberUsage Question

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions