Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: How to split dataframe object rows to columns
Post: How to split dataframe object rows to columns

Hi, I have below data frame (multiple rows): I want to split rows at dilimiter to columns df_obj: 20;12;AA;2020/11/05 10:23:13;2020/11/05 10:25:13;12;LL 20;12;PT;2020/11/05 11:18:13;2020/11/05 11:23...
Mekala General Coding Help 1 755 Nov-12-2020, 02:31 PM
    Thread: How to get index of minimum element between 3 & 8 in list
Post: How to get index of minimum element between 3 & 8 ...

Hi, I have the below list, and I want to get the index of minimum element which is >3 & <=8. my_list = [-1,4,-5,0,2,11,9,8,6] #below only grep minimum whose value >0 m = min(i for i in ...
Mekala General Coding Help 2 931 Nov-10-2020, 10:44 AM
    Thread: How to get indices of minimum time difference
Post: How to get indices of minimum time difference

Hi, I have below data: df1: time1 time2 2020/11/05 20:30:23 2020/11/05 20:20:23 2020/11/05 20:40:12 2020/11/05 20:20:23 2020/11/05 20:49:53 2020/11/05 20:20:23 2020/11/05 20:...
Mekala General Coding Help 1 706 Nov-09-2020, 03:06 PM
    Thread: Pandas, How to trigger parallel loop
Post: RE: How to trigger parallel loop

(Oct-28-2020, 02:21 PM)Larz60+ Wrote: This is really a pandas question, not csv, as pandas reads in the data. Yes, but more generally I would put it this way: how to trigger multithreading
Mekala General Coding Help 4 985 Oct-29-2020, 12:58 PM
    Thread: Pandas, How to trigger parallel loop
Post: RE: How to trigger parallel loop

import os import pandas as pd df_result =pd.DataFrame() directory = os.path.join("D:\\","\PythonCodes\inputmultifiles") for root,dirs,files in os.walk(directory): for file in files: f ...
Mekala General Coding Help 4 985 Oct-28-2020, 11:40 AM
    Thread: How to read csv files parallay
Post: RE: How to read csv files parallay

I use below code. import os import pandas as pd df_result =pd.DataFrame() directory = os.path.join("D:\\","\PythonCodes\inputmultifiles") for root,dirs,files in os.walk(directory): for file in ...
Mekala General Coding Help 2 691 Oct-24-2020, 07:33 AM
    Thread: How to read csv files parallay
Post: How to read csv files parallay

Hi, I have multiple CSV files in the folder, I want to read them parallelly. Each file takes 1min to read and do some calculations. I want to read CSV files simultaneously (parallelly) and concate the...
Mekala General Coding Help 2 691 Oct-23-2020, 02:22 PM
    Thread: Pandas, How to trigger parallel loop
Post: Pandas, How to trigger parallel loop

Hi, I have multiple CSV files in the folder, and I need to read each file and some calculation (like getting the first coulmn sum) and concate to result_df. Is there any method in python? to achieve t...
Mekala General Coding Help 4 985 Oct-23-2020, 01:05 PM
    Thread: How to grep corresponding value in another df
Post: RE: How to grep corresponding value in another df

I am not very familiar of DataFrame.join(). My purpose is to take "df" is actual, and df2 is target. and want to calculate difference between actual (in df1) and target in df2 for sun1, sub2, rank1 co...
Mekala General Coding Help 2 632 Oct-13-2020, 02:52 PM
    Thread: How to grep corresponding value in another df
Post: How to grep corresponding value in another df

Hi, I have two data frames, df1: Model group  type sub1 sub2 rank1 status  200B   R2R    v1     5     6      3        Y 200C   Mon    v2    12    3.2   9        Y 200B   Mon    v1     3     8.9   5  ...
Mekala General Coding Help 2 632 Oct-13-2020, 02:13 PM
    Thread: How to check spec table in another df
Post: How to check spec table in another df

Hi, I have data frame as below: group subgroup category name   T    S     P     R A1      W           1           MAK     2    5.1  2     6  A1      L            2           RAL      2    5     2    ...
Mekala General Coding Help 0 464 Oct-11-2020, 02:25 PM
    Thread: How to print n days back date at give time
Post: How to print n days back date at give time

Hi, I want to print "N" days back date with specified time. I use below code but it error: from datetime import datetime, timedelta Quote:N = 2 date_N_days_ago = datetime.now().strftime("%Y-%M-%D 07:...
Mekala General Coding Help 1 735 Oct-10-2020, 02:54 AM
    Thread: Make list of dates between today back to n days
Post: RE: Make list of dates between today back to n day...

I corrected, but still give empty (no error) from datetime import date, datetime, timedelta def datetime_range(start, end, delta): current = start print(current) if not isinstance(delta, ...
Mekala General Coding Help 3 825 Oct-03-2020, 09:26 AM
    Thread: Make list of dates between today back to n days
Post: Make list of dates between today back to n days

Hi, I want to make list of dates from now back to n days (for example 2 days) with time interval 12hrs. I use the bewlow code, but its giving me empty. from datetime import date, datetime, timedelta...
Mekala General Coding Help 3 825 Oct-01-2020, 10:05 AM
    Thread: How to melt dataframe multiple columns to one column
Post: How to melt dataframe multiple columns to one colu...

Hi, I have below dataframe, I want to melt all columns to one column. I use below code, but some thing I am missing import pandas as pd df = pd.DataFrame({'ID':['A1','A2','A1'],\ 'Estart':[1,2,3],\ ...
Mekala General Coding Help 1 982 Sep-23-2020, 10:35 PM
    Thread: Create a sequential number (counter) and reset at each duplicate
Post: Create a sequential number (counter) and reset at ...

Hi, I want to assign serial number but reset at repeating row I use the below code, but I am not achieving the desired output. import pandas as pd df = pd.DataFrame({'ID':['A1','A2','A1','A3','A4',...
Mekala General Coding Help 0 615 Sep-20-2020, 05:02 AM
    Thread: How to reset row value in pandas
Post: How to reset row value in pandas

Hi, I have below dataframe: df ID Grp subGrp Rank SNO A.1 A.0 A S 1 A.2 A.0 A S 1 A.2 A.0 A N 1 A.6 A.0 A N 1 A.3 A.0 A S 1 A.1 A.B A ...
Mekala General Coding Help 0 544 Sep-19-2020, 09:36 AM
    Thread: How to diff pandas rows and modify column value
Post: RE: How to diff pandas rows and modify column valu...

I used below: df['value'] = (df[['sub_set']] != df[['sub_set']].shift()).any(axis=1).cumsum()but I dont want to sum. I want to reset row value to 1, and increase continuously until next instance(next ...
Mekala General Coding Help 1 641 Sep-18-2020, 12:38 PM
    Thread: How to diff pandas rows and modify column value
Post: How to diff pandas rows and modify column value

Hi, I have bewlow pandas dataframe: ID sub_set group Rank A1 A.0 A 1 A2 A.0 A 2 A1 A.1 A 3 A3 A.0 A 4 A4 A.0 A 5 A5 A.0 A 6I want to re...
Mekala General Coding Help 1 641 Sep-18-2020, 11:35 AM
    Thread: How to mark duplicate rows in pandas
Post: RE: How to mark duplicate rows in pandas

I tried as below: idx= df.duplicated(['ID', 'Pop', 'SG','Stg']).tolist() indexes = [n for n,x in enumerate(idx) if x==True] df['new_col']='NOR' df['new_col'].iloc[indexes]='DUP'but there is a warning...
Mekala General Coding Help 3 954 Sep-17-2020, 01:43 PM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020