Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
1 vote
5 answers
86 views

String Manipulation based on Char Length in a dataframe

I wanted to do some string manipulation based on Char length condition. I have this table, let's called it sample table. RiskCode A01 A02.999 I want to transform the RiskCode column in sample ...
Dhestar Bagus Wirawan's user avatar
0 votes
4 answers
59 views

How do I extract substrings of a dataframe column by referencing another column?

Let's say I have a dataframe as below: import pandas as pd nhl_df = pd.DataFrame({ "team": ["Tampa Bay Lightning", "Boston Bruins", "Toronto Maple Leafs", ...
JJin's user avatar
  • 1
1 vote
3 answers
53 views

Cell value breakdown and string split with uneven length

I need to breakdown the string values contained in a column. Some cells do not need any split at all. Others might required one, two, or more. I would also like the split values to be stored in ...
YouLocalRUser's user avatar
0 votes
1 answer
52 views

Identifying Correct String Order in Pandas

I have a dataframe as the following, showing the relationship of different entities in each row. Child Parent Ult_Parent Full_Family A032 A001 A039 A001, A032, A039, A040, A041, A043, A043, A045, ...
L H's user avatar
  • 27
0 votes
2 answers
56 views

How to fix column with numeric values that is taken as a string field because of empty strings in Pandas dataframe?

I have a df with some columns that are supposed to be numeric fields. However, there are empty strings existing in these columns, which leads to their data being incorrectly assigned as 'object'. How ...
szheng's user avatar
  • 5
0 votes
1 answer
47 views

Convert range of numbers to average in a pandas dataframe cell

I have a pandas dataframe read from large spreadsheets provided through a survey. In a column that expects float input, some of the cell entries are expressed as "n1-n2" (where n1 and n2 are ...
user2751530's user avatar
0 votes
1 answer
31 views

map one column value to another column in python dataframe

I have a dataframe with below columns in it - id|title| 23|xyz| 34|kij| 123|hyu| 45|NaN| 345|None| I want new column in it , expected output - id|title|url 23|xyz|https://www.cl.com/23/xyz 34|kij|...
emiley mille's user avatar
0 votes
0 answers
72 views

How do I get the list of the longest common substrings with a minimum length in a Pandas DataFrame column of strings that is over 10000 entries?

So I have a pandas DataFrame where there are over 50000 rows. In one column, there is a list of strings that has no spaces, and is converted to lowercase, and there are multiple junk characters. The ...
Saadevni's user avatar
1 vote
3 answers
56 views

Concatenating row, column indexes from a dataframe

I have one dataframe like this with the first column is the index (i.e., index = [1,2,3]): 1 2 3 1 0 0.43 0.61 2 0.88 0 0.12 3 0.33 0.95 0 The new dataframe ...
Laura's user avatar
  • 97
0 votes
6 answers
61 views

Extract substring between a : and a string of a predefined set of strings

I have the following input as a a column of a df, each row is one string: surname: Chardon firstname: Marie occupation: idem link: fille age: 30 surname: Lhopital firstname: Louis-Jean occupation: sp ...
CrazyTiger's user avatar
0 votes
2 answers
88 views

Could not convert string to float: '5,994.98'

You can see here the desired output Desired Output Code if you want see = https://github.com/LLNL/mttime/blob/master/examples/notebooks/02_Prepare_Data_and_Synthetics_For_Inversion.ipynb Error in ...
op1's user avatar
  • 9
-1 votes
1 answer
37 views

Incrementally number blocks of rows based on time limits in another column

I have a df with 3 fields as shown below, I'd like for shift number to incrementally generate based on pick start time. If pick start time between 22:00 and 0600, thats shift 1; then iterate for all ...
awo's user avatar
  • 13
0 votes
1 answer
53 views

Replace row values after a certain string pattern in R using stringr [duplicate]

I have a data frame in R called df: name=c("john","mary","stef","paul","helen") var =c("[1127] pizza" , ...
Homer Jay Simpson's user avatar
2 votes
2 answers
94 views

Checking continuity of numbers within a string

I have a string listing the terms in office of an individual, e.g. all_terms <- "2012 to 2024, 2007 to 2007, 2001 to 2003, 2000 to 2009, 2010 to 2011" I want to know whether the ...
user17661126's user avatar
0 votes
1 answer
55 views

Separating a column based on a string pattern in R using tidyverse functions

I want to create two columns from the DATA given below. I want the first column (say ID1) to have all the letters or numbers before the first "-" starting from left to right and the second ...
Homer Jay Simpson's user avatar

15 30 50 per page
1
2 3 4 5
139