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

All Questions

Tagged with
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
-3 votes
0 answers
67 views

Split pandas series/dataframe column has long mail chain to muliple rows, using regex

I have a pandas data frame in which one column of text strings contains long mail chains. I want to split each mail chain in one row to extract fields like: to:, from:, cc: ,date and body and create ...
prateek s's user avatar
2 votes
2 answers
49 views

Convert string to dataframe after extracting using BeautifulSoup

import requests import pandas as pd from bs4 import BeautifulSoup as bs from io import StringIO url = "https://www.tickertape.in/stocks/oil-and-natural-gas-corporation-ONGC" r = requests....
Abinash Tripathy's user avatar
2 votes
1 answer
41 views

pandas string selection

I would like to extract rows containing a particular string - the string can be a part of a larger, space-separated string (which I would want to count in), or can be a part of another (continuous) ...
branwen85's user avatar
  • 1,688
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
37 views

Python seems to return incorrect data length for NULL value from a Pandas dataframe

I am trying to find the longest value and its length from a column in a Pandas dataframe. This column holds country codes which are strictly 2 charterers without any empty strings or spaces, but data ...
szheng's user avatar
  • 5
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
2 votes
2 answers
71 views

Check if a string contains all words in a phrase from a list in python

I have a list of phrases and I need to be able to identify whether each row in a dataset contains all the words from any of the phrases in my list. Take my example problem below. I have a dataset ...
Maria's user avatar
  • 49
1 vote
1 answer
53 views

Python : 2 (or more) conditional strings in a groupby agg

Here is my issue : In my Pandas dataframe "Dataset", I would like to get the following result : when the column "Product" has the value "Ref_01" at least once, I want to ...
R_User_001's user avatar
0 votes
0 answers
41 views

pandas groupby() gives me an error when trying to do numerical opperation on dataframes also containing strings [duplicate]

I'm new to pandas and I'm a bit confused about a difference concerning my output and the output seen in reference material. Lets say I use groupby("something") on a dataframe which contains ...
buboj's user avatar
  • 1
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
0 answers
40 views

Iterate over two string columns to find if one appears in the other [duplicate]

I am new to Python and trying to find a way of comparing one column of strings to another column of strings for the length of the dataset. I would like to create a binary variable as the result to ...
user24645857's user avatar

15 30 50 per page
1
2 3 4 5
224