All Questions
135 questions
1
vote
2
answers
59
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 ...
1
vote
2
answers
43
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
66
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
votes
1
answer
48
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
39
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
117
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-2021 15:...
0
votes
1
answer
133
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
66
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
25
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 ...
0
votes
1
answer
71
views
How to extract values from dataframe in a complicated way
I have a dataframe. I want it to filter it and reduce certain values to a string. The dataframe looks like this
EXPECTED OUTPUT
42.0(1A,1B,0C)
41.0(1A,1B,0C)
43.0(0A,1B,0C)
45.0(1A,1B,0C)
Code:
data ...
1
vote
1
answer
846
views
How to find list data not in Pandas Dataframe
I have below the dataframe in pandas
import pandas as pd
df = pd.DataFrame([
['server1', 'NA', 'NA', '2011-03-31'],
['server1', '2011-02-22', 'NA', 'NA'],
['server1', 'NA', '...
1
vote
1
answer
377
views
Reading CSV file as a key value pair
I have a CSV file as mentioned below.
CSV file content :
NAME
SURNAME
AGE
Shri
siri
23
Golu
Kumar
25
I need to read this CSV file as a key value pair.
[{'NAME':'Shri', 'Surname':'siri', 'Age':'23'}]
[{...
-1
votes
2
answers
373
views
Number Formatting in DataFrame
How can I format a subset of a DataFrame according to a custom formatting logic?
Before:
Country
Last
Previous
Abs. Change
0
United States
8.60
8.30
0.30
1
Japan
2.50
2.50
0.00
2
China
2.00
2.10
-0.10
...
0
votes
1
answer
948
views
How to read multiple levels of JSON file through Python pandas?
I am trying to read a JSON file where the data are at various level, i.e. Top --> inner --> inner most.
I have tried the pd.json_normalization, but I don't think it is working. I have attached a ...