Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Get an average of the unique values of a column with group by condition and assign it
Post: Get an average of the unique values of a column wi...

I'm trying to get an average of the unique values of a column with a group by condition. In the method, I followed I had to create a new data frame for unique values and then merge the results into t...
klllmmm General Coding Help 0 323 Feb-17-2024, 05:53 PM
    Thread: Better python library to create ER Diagram by using pandas data frames as tables
Post: Better python library to create ER Diagram by usin...

I'm looking for a better python library to create ER diagrams. I want to input pandas tables as tables and then add relationships between tables. I tried many libraries, finally found this "pandaser...
klllmmm General Coding Help 0 1,190 Oct-19-2023, 01:01 PM
    Thread: Add two resultant fields from python lambda function
Post: RE: Add two resultant fields from python lambda fu...

(Jun-03-2023, 11:52 AM)Gribouillis Wrote: There is no difference between using a function and using a lambda expression. In the above lambda expression, I think the else part should be else (np.nan,...
klllmmm General Coding Help 4 946 Jun-03-2023, 12:05 PM
    Thread: Add two resultant fields from python lambda function
Post: Add two resultant fields from python lambda functi...

I have a dataframe where i would like to add two fields at once based on a condition. I can achieve this by defining a function. import pandas as pd df1 = pd.DataFrame(data = {'name':["Total",'Tozi ...
klllmmm General Coding Help 4 946 Jun-03-2023, 11:19 AM
    Thread: Get numpy ceil and floor value for nearest two decimals
Post: Get numpy ceil and floor value for nearest two dec...

I'm trying to get ceiling value of the input for two decimals. import numpy as np a = np.array([-1.784, -1.5888, -0.24444, 0.25555, 1.5, 1.75, 2.0]) np.around(a,2)array([-1.78, -1.59, -0.24, 0.26,...
klllmmm General Coding Help 4 1,319 Jun-02-2023, 05:29 AM
    Thread: Correctly read a malformed CSV file data
Post: RE: Correctly read a malformed CSV file data

@buran This is perfect.... Thank you so much!! (Jan-25-2023, 02:18 PM)buran Wrote: read the whole file in memory and replace \n with just "" import pandas as pd from io import StringIO file_pa...
klllmmm General Coding Help 2 2,022 Jan-25-2023, 04:12 PM
    Thread: Correctly read a malformed CSV file data
Post: Correctly read a malformed CSV file data

I have a malformed CSV file where I need to create a proper dataframe. [Image: https://1drv.ms/u/s!An03iU493hAgnpxZ2rP2...w?e=djFMls] I get an error when reading with pandas Error:ParserError: Error ...
klllmmm General Coding Help 2 2,022 Jan-25-2023, 02:09 PM
    Thread: How to assign a value to pandas dataframe column rows based on a condition
Post: How to assign a value to pandas dataframe column r...

Hello, I want to assign a value in "Value" column into a new column and up to all next empty rows until next value comes. My expected value is available in a new column 'Expected_Value'. import pand...
klllmmm General Coding Help 0 869 Sep-08-2022, 06:32 AM
    Thread: Remove if similar values available based on two columns
Post: Remove if similar values available based on two co...

I want to remove the duplicates (keeping only the first occurrence) if similar values are found between two columns. import pandas as pd df1 = pd.DataFrame({'Customer':['John Tom', 'Harry', 'Simon', ...
klllmmm General Coding Help 1 1,386 Feb-20-2022, 05:05 PM
    Thread: Move a particular row in pandas data frame to last row
Post: Move a particular row in pandas data frame to last...

I'm trying to move a particular row in the below data frame to the last position of the data frame. Can someone help me to achieve this? import pandas as pd df1 = pd.DataFrame(data = {'name':["Total...
klllmmm General Coding Help 0 3,814 Dec-27-2021, 09:11 AM
    Thread: Sum the values in a pandas pivot table specific columns
Post: RE: Sum the values in a pandas pivot table specifi...

Managed to sort this pivot_1['Type A Total'] = pivot_1[("sum", "Sales", "Type A")].sum(axis=1)
klllmmm General Coding Help 1 4,680 Nov-19-2021, 04:43 PM
    Thread: Sum the values in a pandas pivot table specific columns
Post: Sum the values in a pandas pivot table specific co...

I have created a pivot table with multiple index as follows: df1 = pd.DataFrame(data = {'Customer':['Tom Ford','Susan Mock','Tom Ford','Tom Ford','Donale Fucci','Jo Watthanaram'], ...
klllmmm General Coding Help 1 4,680 Nov-19-2021, 03:37 PM
    Thread: How to get datetime from numeric format field
Post: RE: How to get datetime from numeric format field

Thanks!! @deanhystad
klllmmm General Coding Help 3 2,021 Nov-06-2021, 12:06 PM
    Thread: How to get datetime from numeric format field
Post: How to get datetime from numeric format field

Hi there, Can someone help me to extract datetime from the following "data" field import pandas as pd import datetime as dt df1 = pd.DataFrame(data={"fruit":['apple','pear','banana','peach'], ...
klllmmm General Coding Help 3 2,021 Nov-03-2021, 04:00 AM
    Thread: How to combine multiple rows of strings into one using pandas?
Post: RE: How to combine multiple rows of strings into o...

Hope you can see such output from this code import re for i in range(Data_list.shape[0]): #iterate over rows for j in range(Data_list.shape[1]): #iterate over columns if ((i ==0) & (...
klllmmm General Coding Help 1 3,172 Aug-22-2021, 05:26 AM
    Thread: Identify anomalies in a payment detail dataset for a period
Post: Identify anomalies in a payment detail dataset for...

I noticed that we can use Facebook Prophet for univariate and Multivariate type time-series datasets. Univariate - Date, target (eg. Payments amount) Multivariate - Date, target (eg. Payments amount)...
klllmmm Data Science 1 1,925 Aug-05-2021, 02:41 AM
    Thread: Apply fillna to multiple columns in dataframe
Post: RE: Apply fillna to multiple columns in dataframe

Try adding; inplace=True
klllmmm General Coding Help 2 2,483 Aug-05-2021, 01:30 AM
    Thread: pandas.errors.ParserError: Error tokenizing data. C error: Expected 9 fields in line
Post: RE: pandas.errors.ParserError: Error tokenizing da...

1. Try defining the particular character used in dataset to separate fields eg - X = pd.read_csv(r"D:\Clustering\text-cluster-master\text-cluster-master\Articles.csv", index_col='id',delimiter='|')2...
klllmmm General Coding Help 9 15,448 Jun-13-2021, 03:42 PM
    Thread: Unable to access the user input value given to daterangepicker
Post: Unable to access the user input value given to dat...

In an HTML web form, I want to access the user-selected date range (backend is in python django framework, I'm referring the daterange picker examples in this page http://www.daterangepicker.com/#exam...
klllmmm General Coding Help 1 2,320 May-26-2021, 06:48 PM
    Thread: Schedule a task and render/ use the result of the task in any given time
Post: RE: Schedule a task and render/ use the result of ...

(May-04-2021, 07:07 AM)menator01 Wrote: Not sure if this is what you want import schedule, time from datetime import datetime def my_task(): custom_time = datetime(2021, 5, 1, 17, 30, 29, 43171...
klllmmm General Coding Help 2 2,129 May-04-2021, 10:17 AM

User Panel Messages

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