Slice string in multiple column with same condition

alex3465

I have multiple column that I need to slice with same condition I can see some solution here but they do not work with multiple column

df['x', 'y']=df['x', 'y'].str.slice(0,19)

Error

AttributeError: 'DataFrame' object has no attribute 'str'
Walid

You need to use the apply function to a apply it on multiple columns:

df[['x','y']]=df[['x','y'].apply(lambda x:x.str.slice(0,19))

It should give the correct output.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

Search for multiple conditions on same column?

From Dev

Pandas make new column from string slice of another column

From Dev

multiple condition if statement string keywords: in, not in

From Dev

GROUP BY multiple values in same column

From Dev

SQL query to implement multiple WHERE condition on same column

From Dev

Select sum of same column based on a condition

From Dev

Multiple Filter in the same column

From Dev

Python multiple condition IN string

From Dev

Mongodb multiple OR condition on same key

From Dev

joint result for multiple condition on same column

From Dev

Apply where condition on same column many times

From Dev

drop column based on a string condition

From Dev

select multiple column with different condition

From Dev

How filter multiple column with the same condition?

From Dev

Slice string in multiple column with same condition

From Dev

Multiple values against same condition

From Dev

How to count multiple string value in a same column with sum values in adjacent column

From Dev

How to apply multiple condition in same column in excel

From Dev

multiple like on same column and give first prority which satisfy maximum or condition

From Dev

MySQL Left Join With And Condition To Same Column

From Dev

drop column based on a string condition

From Dev

Multiple ordering on same column with different condition

From Dev

pandas multiple condition and add multiple column

From Dev

Numpy Slice Array Column Based on Row Condition

From Dev

How to update multiple rows of multiple columns with single value having same condition for every column

From Dev

Two where condition for same column using group by

From Dev

Selecting with Multiple OR and AND on same column

From Dev

to write a select query which strictly satisfies a multiple condition on same column

From Dev

Create a new column in pandas based on values in multiple columns and the same condition

Related Related

  1. 1

    Search for multiple conditions on same column?

  2. 2

    Pandas make new column from string slice of another column

  3. 3

    multiple condition if statement string keywords: in, not in

  4. 4

    GROUP BY multiple values in same column

  5. 5

    SQL query to implement multiple WHERE condition on same column

  6. 6

    Select sum of same column based on a condition

  7. 7

    Multiple Filter in the same column

  8. 8

    Python multiple condition IN string

  9. 9

    Mongodb multiple OR condition on same key

  10. 10

    joint result for multiple condition on same column

  11. 11

    Apply where condition on same column many times

  12. 12

    drop column based on a string condition

  13. 13

    select multiple column with different condition

  14. 14

    How filter multiple column with the same condition?

  15. 15

    Slice string in multiple column with same condition

  16. 16

    Multiple values against same condition

  17. 17

    How to count multiple string value in a same column with sum values in adjacent column

  18. 18

    How to apply multiple condition in same column in excel

  19. 19

    multiple like on same column and give first prority which satisfy maximum or condition

  20. 20

    MySQL Left Join With And Condition To Same Column

  21. 21

    drop column based on a string condition

  22. 22

    Multiple ordering on same column with different condition

  23. 23

    pandas multiple condition and add multiple column

  24. 24

    Numpy Slice Array Column Based on Row Condition

  25. 25

    How to update multiple rows of multiple columns with single value having same condition for every column

  26. 26

    Two where condition for same column using group by

  27. 27

    Selecting with Multiple OR and AND on same column

  28. 28

    to write a select query which strictly satisfies a multiple condition on same column

  29. 29

    Create a new column in pandas based on values in multiple columns and the same condition

HotTag

Archive