0 OHN m 1 2 3 4 ships_to_country_ids [209, 0, 150, 79, 175] [79, 167, 290, 284, 209, 61, 58, 74, 105, 55, [70, 118, 146,

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

0 OHN m 1 2 3 4 ships_to_country_ids [209, 0, 150, 79, 175] [79, 167, 290, 284, 209, 61, 58, 74, 105, 55, [70, 118, 146,

Post by answerhappygod »

0 Ohn M 1 2 3 4 Ships To Country Ids 209 0 150 79 175 79 167 290 284 209 61 58 74 105 55 70 118 146 1
0 Ohn M 1 2 3 4 Ships To Country Ids 209 0 150 79 175 79 167 290 284 209 61 58 74 105 55 70 118 146 1 (30.78 KiB) Viewed 51 times
Dataframe with index, and the a string with country numbers itships to.
I want to add a new column, which gives the sum of the countryit ships to. So for the first row, the new column should give 5(because [209, 0, 150, 79, 175].
But if i try to print the length of the first row, it gives 22 (by print(len(df['ships_to_country_ids])) ) as it is a string, andnot a list.
0 OHN m 1 2 3 4 ships_to_country_ids [209, 0, 150, 79, 175] [79, 167, 290, 284, 209, 61, 58, 74, 105, 55, [70, 118, 146, 90, 151, 79, 207, 91, 71, 215, [175, 61, 80, 220, 219, 204, 56, 103, 79, 128,. [209, 167, 127, 0, 203, 61, 131] [120, 0] 2... [0, 209] [0, 209] [209, 68, 91, 0] 9993 9994 [155, 151, 99, 243, 278, 144, 127, 180, 207, 9996 9998 9999 1
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply