Skip to main content

All Questions

Tagged with
1 vote
2 answers
71 views

How to create a new column based on an existing column matching one of four lists? [duplicate]

I have a dataframe with a column called "education" which has over 100 unique values. I want to create a new column and categorize "education" into four levels: high school, ...
maximum_confusion's user avatar
1 vote
2 answers
93 views

Pandas indexing

Can someone explain what is meant by Both loc and iloc [in Pandas] are row-first, column-second. This is the opposite of what we do in native Python, which is column-first, row-second. Because I ...
Obase Oyeni Ayomobi's user avatar
1 vote
2 answers
93 views

Parsing Multi-Index Pandas Data Frame for Tuple List Appendage

Problem/Task: create a function that inputs a pandas data frame represented by the markdown in Fig 1 and converts/outputs it to a list with the structure represented in Fig 2. I look forward to any ...
BP130's user avatar
  • 67
0 votes
0 answers
48 views

Python - Pandas matching two json API dumps as dataframes

I'm a network admin working on a small project at work using Cisco's Meraki API wrapper for Python The end goal is to have a dashboard that displays the amount of authenticated users on a single ...
Promise's user avatar
0 votes
3 answers
85 views

Check if specific value in a series is NaN

I have a Dataframe where I want to derive a Boolean column based on some other columns, including a check on whether a particular column is NaN: def secret_sauce(my_row): if (pd.isna(my_row["...
Stephen's user avatar
  • 8,917
0 votes
3 answers
116 views

How to remove duplicates and unify values in lists where values are very close to each other in Python?

I have in Python lists like below: x1 = ['lock-service', 'jenkins-service', 'xyz-reporting-service', 'ansible-service', 'harbor-service', 'version-service', 'jira-service', 'kubernetes-service',...
dingaro's user avatar
  • 2,342
0 votes
0 answers
23 views

Compare dataframe with list [duplicate]

I've a script that try to reach some router on the field (from a list in csv), then write a result csv file. My script have an early condition that check if there is an existing "result.csv" ...
BenjiBoy's user avatar
  • 305
1 vote
2 answers
89 views

Pandas create % and # distribution list in descending order for each group

I have a pandas dataframe like as below data = { 'cust_id': ['abc', 'abc', 'abc', 'abc', 'abc', 'abc', 'abc', 'abc', 'abc', 'abc'], 'product_id': [12, 12, 12, 12, 12, 12, 12, 12, 12, 12], '...
The Great's user avatar
  • 7,753
1 vote
1 answer
84 views

Pandas order column with lists by pairs

Here is the dataframe: df1 = pd.DataFrame( {'st': {0: 1, 1: 0, 2: 2, 3: 0, 4: 1, 5: 5, 6: 0, 7: 7, 8: 19, 9: 0, 10: 0, 11: 0, 12: 3, 13: 0}, 'gen': {0: 'B1', 1: 'A0,B0', 2: 'A1,B1', 3: 'A0,B0', 4: '...
josepmaria's user avatar
0 votes
3 answers
83 views

Join lists of strings in a dataframe column while ignoring null values

I have a DataFrame column consisting of lists of strings and one NaN value. I am trying to join the lists of strings while ignoring the NaN with df.loc, Series.notnull(), and Series.apply(). I expect ...
shujufenxishi's user avatar
1 vote
3 answers
70 views

split dataframe by multiple lists. loop?

I have a dictionary of lists of student numbers, and a dataframe that contains those student numbers and more. I want to separate that dataframe into multiple dataframes, each which contains the rows ...
Meg Ward's user avatar
4 votes
1 answer
60 views

lists from a column in dataframe

I have a dataframe that consists of lists of students from different semesters (also grades etc) I want to create a dictionary of lists of students who started in a given semester. I have filtered the ...
Meg Ward's user avatar
1 vote
2 answers
77 views

Unpack values from column, which consist of list of dictionaries

I have dataframe, which looks like this: import pandas as pd df = pd.DataFrame({"item_id": [1, 2, 3], "item_properties":[ ...
Artem's user avatar
  • 11
-1 votes
1 answer
147 views

Convert List of JSON to Dataframe to Multiple Excel Sheets

I have list of multiple objects that I want to convert into excel and I need individual object to be on different sheets. I have looped the list then to convert to Dataframe see below list of json I ...
Codephree Coding's user avatar
4 votes
5 answers
106 views

Check following element in list in pandas dataframe

I have created the following pandas dataframe import pandas as pd import numpy as np ds = { 'col1' : [ ['U', 'U', 'U', 'U', 'U', 1, 0, 0, 0, 'U','U', None], ...
Giampaolo Levorato's user avatar

15 30 50 per page
1
2 3 4 5
284