All Questions
Tagged with python-2.7 dataframe
982
questions
1
vote
2
answers
51
views
Python Pandas data frame column split based on previous unique columns combination [duplicate]
I have a data frame like below:
TAG TAG_NAME METRIC METRIC_NAME CAPTURE_DATE MB
DB PRO SPACE A 2024-03-01 3
DB PRO SPACE B 2024-03-01 4
DB ...
0
votes
0
answers
9
views
ValueError: it Can only compare identically-labeled Series objects
I have a wine dataset which I'm analyzing. The response variable in the dataset is the wine quality. I visualized the relationship between other variables and the response variable using a boxplot, ...
1
vote
2
answers
40
views
Expanding the Dictionary item from datafame column
I have pandas dataframe with a column
I have a dataframe with a column having the value like below
df['dbpedia_entry']
{'dbpedia_entity': ['c'],'dbpedia_id': ['f'],'dbpedia_label': ['k'],'...
1
vote
1
answer
58
views
Append the column names corresponding to the minimum row values of a dataframe to create a new dataframe
I have the following dataframe
import pandas as pd
data = [[5,4,3,2,6,8], [9,1,5,4,8,6], [7,6,8,1,2,4], [9,6,5,4,8,3]]
df = pd.DataFrame(data, columns=['Col1','Col2','Col3','Col4','Col5','Col6'])
df
...
1
vote
2
answers
825
views
How to convert two array columns into an array of structs based on array element positions in PySpark?
New to PySpark and need help with this problem I'm running into
I have a dataframe that contains two columns as shown below:
+------------------+--------------------+
| first_name | last_name ...
0
votes
1
answer
85
views
How do I replace column names in a list with column values in the same row? [duplicate]
I've got a dataframe where 1 column lists Max value column names, Based on the names I'd like to replace them with those column values on the same row
Max
Column A
Column B
Column C
Column C
200
500
...
0
votes
0
answers
69
views
Importing Excel file into Panda (Python) using conditions
I am using Python 2.7.18.4 (I know an old version, but I cannot change) to import a set (probably around 1000, maybe more) of Excel files. Each Excel file contains the same column I am interested, but ...
-1
votes
1
answer
46
views
Parse the dictionary values in CSV [closed]
CSV File contains
id,type,attributes
1,xx,{'data': { 'attributes': {'aggregations': [{'space': 'sum','time': 'sum'}],'created_at': '2020-03-25T09:48:37.463835Z','include_percentiles': true,'...
0
votes
2
answers
38
views
Merge dataframes having array
I have two data frames.
DF1
isActive,trackedSearchId
True,53436615
True,53434228
True,53434229
DF2
trackedSearchIds,Primary Keyword Group(s)
"[53436613, 53436615, 53437436, 53436506]",SEO - ...
0
votes
1
answer
87
views
merge or concat two rows in same Dataframe in Python
I have one dataframe where there are 4 records, for 1 ConfigID(with B & G) we have two rows, Need to replicate the row with value into the row where there is no value. Is it possible in python? ...
1
vote
3
answers
106
views
How can I assign a tag to the smallest in one group, second smallest in another group and third smallest in the third group to a pandas dataframe?
I have the below data frame,
ID
Group
Date_Time_1
Date_Time_2
Difference
New_Column
123
A
14-10-2021 15:19
14-10-2021 15:32
13
First
123
A
14-10-2021 15:19
14-10-2021 15:36
17
null
123
A
14-10-...
0
votes
1
answer
123
views
Append row to DataFrame in Pandas and putting it on bottom
I want to add a row to a multi-index dataframe and I want to group it in its outer index where the alphabetical order is important, i.e, I can't use df.sort_index().
Here is the problem.
Code:
import ...
0
votes
2
answers
54
views
How to associate repeated strings with values from a dictionary in a dataframe?
I'm trying to associate in a dataframe the values of a list of numbers with the respective strings. Here's the problem:
import pandas as pd
categories = {"key1":["string1", "...
0
votes
1
answer
11
views
Get 2 DataFrames into 1
Hi everyone so I have a DataFrame about Pokemon data
data = pd.read_csv('pokemon.csv')
And I'm only interested in 2 columns 'type1' 'type2' (type2 can be null) as the same way the original videogame ...
0
votes
1
answer
24
views
How to create dataframe from txt file of column_name: value where rows are delimited by empty line
I have a (2GB) txt file as follows
column_name_1: value_1_1
column_name_2: value_1_2
column_name_3: value_1_3
column_name_1: value_2_1
column_name_2: value_2_2
column_name_3: value_2_3
Meaning ...