Skip to main content

All Questions

Tagged with
1 vote
3 answers
67 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
-2 votes
2 answers
103 views

Loop over string values from a list

I am trying to loop over a line of code with string values from a list: (I am trying to join the dummy variables I got from pandas. get_dummies to the original dataframe. var1, 2, 3 are dummies) ...
Serena's user avatar
  • 3
-1 votes
1 answer
60 views

Creating a df based on total permutations deriving from user-input variables

I would like to pass 'n' amount of cities to travel to and corresponding days in each city to a function that would return a df with all possible permutations of the journey. The kayak_search_url ...
June Smith's user avatar
0 votes
1 answer
37 views

Checking if a word from dataset A is present in the sentence of dataset B

I am a beginner in Python so I get stuck sometimes in easy stuff. Please, consider a column of names (securities) and tickers in df1: Security Tickers Google GOOG Twitter TWTR Logitech LOGI and then ...
Giando's user avatar
  • 3
1 vote
1 answer
92 views

How can I find a word and print it along with his next word in Python

I have the following list: pre = ["unable to", "would not", "was not", "did not", "there is not", "could not", "failed to"] From ...
Victor Leon's user avatar
0 votes
1 answer
71 views

How to find defined strings in values in columns in DataFrame using loop in Pandas Python?

I have code in Pandas Python like below: df (both columns are string - "object" data type): col1 col2 123445 one 653144 bbt aaaBc tro code: nominal_variables = ['col1', 'col2'] ...
dingaro's user avatar
  • 2,342
0 votes
0 answers
12 views

Check if a cell has string data when doing pandas iterrow [duplicate]

I'm using iterrows in a dataframe like below to get the time difference ImageA_Time ImageB_Time 0 2022-02-01 06:56:22 2022-02-02 06:56:22 1 No time info 2022-...
Elaine Yang's user avatar
1 vote
1 answer
2k views

How to access files in folder with same string in file name in python?

I am trying to use python to look through a directory folder and match up files with the same strings in the file name. Each of the files of interest in this folder is a ".csv" file, ...
LostinSpatialAnalysis's user avatar
0 votes
2 answers
404 views

Checking if another DataFrame with same name has been created. Error: 'str' object has no attribute 'append'

I'm running a for loop using pandas that checks if another DataFrame with same name has been created. If it has been created, then just append the values to the correspondent columns. If it has not ...
AAV's user avatar
  • 21
0 votes
2 answers
539 views

Copy/assign a Pandas dataframe based on their name in a for loop

I am relatively new with python - and I am struggling to do the following: I have a set of different data frames, with sequential naming (df_i), which I want to access in a for loop based on their ...
DanielFD's user avatar
0 votes
1 answer
77 views

How to check if string elements of lists are in dataframe/other list (python)

I got the following problem. I do have 2 lists/dataframes. One is a list/dataframe of customers, where every row is a customer, the columns are synonyms for these customers, other verbal expressions. ...
DanielSchloß's user avatar
0 votes
0 answers
121 views

How to check password requirements?

I have a database with 982 smaple username and passwords, and I want to find the ratio of bad passwords with these four criterias: Password Requirments: 1- Must be at least 10 characters in length 2- ...
Mahdi Meskin's user avatar
0 votes
3 answers
245 views

Need to strip CSV Column Number Data of Letters - Pandas

I am working on a .csv that has columns in which numerical data includes letters. I want to strip the letters so that the column can be a float or int. I have tried the following: using the loop/def ...
Texanj's user avatar
  • 1
0 votes
2 answers
873 views

Concat strings from dataframe columns in a loop (Python 3.8)

Suppose I have a DataFrame "DS_df" containing strings ands numbers. The three columns "LAultimateparentcountry", "borrowerultimateparentcountry" and "tot" form ...
Maximilian Bach's user avatar
0 votes
0 answers
55 views

I cannot loop through a dataframe because the column is read as string

this is my exampe dataframe and the loop I am trying to pass through it. I also attach the error I get. Example dataframe: x Replicate y 1 1 0.39 2 2 0.08 3 3 ...
Martina Lazzarin's user avatar

15 30 50 per page