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

All Questions

Tagged with
1 vote
2 answers
46 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
53 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
80 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
5 votes
6 answers
114 views

Count consecutive elements in Pandas list

I have created the following pandas dataframe: import pandas as pd import numpy as np ds = {'col1':[1,"S",3,4,"S"], 'col2' : [6,"S",8,9,"S"],'col3' : [67,None,...
Giampaolo Levorato's user avatar
0 votes
2 answers
79 views

Pandas list of list column to Python list

I want to create a list from a Pandas column formatted like so: data = { 'col': [ '[[a, b, c], [a,b]]', '[[a, b], [c]]', '[[x]]' ] } df = pd.DataFrame(data) The ...
bachts's user avatar
  • 63
0 votes
1 answer
32 views

Convert a dataframe with lists to a dictionary [duplicate]

I have a dataframe that contains a identifier and list in each cell. The idea is to create a dictionary in which the keys are the identifiers and the values are a list with the elements that appears ...
Fernando Quintino'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 votes
1 answer
66 views

How to filter out rows with empty lists in Pandas df?

I want to filter out rows containing empty lists in columns no_te_ins and te_ins. Here is part of the input df te_filter: chr family no_te_ins te_ins 16 ...
emor's user avatar
  • 157
1 vote
3 answers
82 views

Compare if a value from one dataframe is in the list of values of another

Consider these two dfs: df1 = pd.DataFrame({ 'Id': {0: 101, 1: 102, 2: 103, 3: 104}, 'Number': {0: 'A1', 1: 'A2', 2: 'B1', 3: 'B1'}}) Id Number 0 101 A1 1 102 A2 2 103 B1 3 104 ...
nzskra's user avatar
  • 171
1 vote
2 answers
82 views

return if list is consecutive within python col

I've got a column within a df labelled a. It contains a list of int values. I want to return if they are consecutive or not. I can do it passing in a single list but I want to iterate over each row. ...
tonydanza123's user avatar
1 vote
2 answers
35 views

Create dataframes with parametrized names [duplicate]

I have a dataframe like: df name value 0 a 10 1 a 5 2 b 4 3 b 8 I want to create filtered datasets using the 'name' feature. Something like: for i in ['a', 'b']: df_{i} = ...
Fernando Quintino's user avatar
0 votes
2 answers
37 views

Pandas - Filter - TypeError: 'in <string>' requires string as left operand, not list

I am exploring Pandas filter and while doing so I came across this error while using the below query df2.filter(like = ['Republic','United'], axis=0 ) How do I provide a list in Like parameter in ...
srijan bansal's user avatar
0 votes
1 answer
93 views

How can i monitor changes in variables python

I have two files that i input as pandas DFs in my code, where the first one has different product categories and the products in stock: Name Stock ART Paintings 20 Ceramics 10 BOOKS Poetry 50 ...
Anna's user avatar
  • 39
0 votes
0 answers
23 views

Multiple dataframe explode for 4 flat lists in pandas [duplicate]

Description: I have 4 lists that I would like to explode in the following order temps, volts, powers and freqs . import pandas as pd temps = [-20,60] volts = [6.3, 7.4] powers = [float(p) for p in ...
Gооd_Mаn's user avatar
  • 1,003
2 votes
0 answers
37 views

Handling Long Category Names in Visualizations of Categorical Variables in Python

I'm working with a pandas DataFrame that contains categorical variables, some of which have values with long names. However, some of my categorical features have values with long names, causing the ...
Emir's user avatar
  • 21

15 30 50 per page
1
2 3 4 5
284