Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: partial functions before knowing the values
Post: RE: partial functions before knowing the values

(Dec-22-2023, 05:46 PM)buran Wrote: (Dec-22-2023, 03:25 PM)mikisDeWitte Wrote: I was also thinking of using *args & **kwargs, but I find that syntax bad for readibility.using *args and **kwarg...
mikisDeWitte General Coding Help 4 601 Dec-22-2023, 09:13 PM
    Thread: partial functions before knowing the values
Post: partial functions before knowing the values

Woops - Duplicate post
mikisDeWitte General Coding Help 4 601 Dec-22-2023, 03:25 PM
    Thread: partial functions before knowing the values
Post: partial functions before knowing the values

Hello python experts! I'm working on a function ("salary_or_name_builder" in the example) that routes my input parameters to multiple functions. Ideally, (for decoupling purposes) that function lets ...
mikisDeWitte General Coding Help 4 601 Dec-22-2023, 03:04 PM
    Thread: matplotlib Plotting smooth line with nans
Post: RE: matplotlib Plotting smooth line with nans

Hm... Not sure I follow what you mean. What I want is exactly the same graph as in my original post. Let's assume that "attr2" was missing in my original data, then I expect: * a single datapoint "at...
mikisDeWitte General Coding Help 4 3,113 Mar-11-2022, 02:40 PM
    Thread: matplotlib Plotting smooth line with nans
Post: RE: matplotlib Plotting smooth line with nans

Hello deanhystad, Yes, that is actually very simple with a very small tweak (cf code below). (source: https://www.geeksforgeeks.org/how-to-plo...atplotlib/) Code result (so with no nan's, I actually...
mikisDeWitte General Coding Help 4 3,113 Mar-11-2022, 01:41 PM
    Thread: matplotlib Plotting smooth line with nans
Post: matplotlib Plotting smooth line with nans

Hello, I want to automate a chart (we call it snake charts, screenshot below) that so far we've been building in Excel. It's a scatter plot with smoothed lines in between where the y-values are just ...
mikisDeWitte General Coding Help 4 3,113 Mar-10-2022, 07:32 PM
    Thread: groupby cast to int where possible
Post: RE: groupby cast to int where possible

In case it helps anyone, I found a workaround for my issue. Basically, I try to cast the column to integers, using errors="coerce". If it can't be interpreted as a number, it converts it to nan. I can...
mikisDeWitte General Coding Help 2 1,860 Jul-08-2021, 11:49 AM
    Thread: groupby cast to int where possible
Post: groupby cast to int where possible

Hello, I need to create a nested dictionary like so: d= {"ftsg2a_co422": {1: 'visited or contacted', 0: 'not visited not contacted'}} this dictionary then goes to a function that sets value labels t...
mikisDeWitte General Coding Help 2 1,860 Jul-01-2021, 01:40 PM
    Thread: pyreadstat write_sav inefficient
Post: RE: pyreadstat write_sav inefficient

(Jun-21-2021, 08:38 AM)buran Wrote: have a look at https://stackoverflow.com/questions/4717...nwrite-sav Also you can try to pass compress=True and create zsav file. Thanks, that seems to be indeed ...
mikisDeWitte General Coding Help 2 2,747 Jun-21-2021, 09:49 AM
    Thread: pyreadstat write_sav inefficient
Post: pyreadstat write_sav inefficient

Hello, My colleagues work mostly in SPSS, so for their sake i export my dataframes to SPSS using the pyreadstat module (installed via conda, version 1.1.2). Everything works fine, except that my expo...
mikisDeWitte General Coding Help 2 2,747 Jun-21-2021, 08:32 AM
    Thread: apply(pd.Series) until no more array
Post: apply(pd.Series) until no more array

Update: we found it eventually. Using the same link, a more recent answer helped us out a lot: df2 = pd.json_normalize(df['Pollutant Levels'])Hello, We extract data from a mongoDB using python. When...
mikisDeWitte Data Science 1 2,781 Apr-14-2021, 02:27 PM
    Thread: dataframe groupby with totals for certain fields
Post: RE: dataframe groupby with totals for certain fiel...

(Oct-23-2020, 05:41 AM)scidam Wrote: Quote:, and I was told that if you're looping then most of the times you're probably doing it wrong In this case loop doesn't apply to all dataframe, you just i...
mikisDeWitte Data Science 4 2,638 Oct-23-2020, 08:13 AM
    Thread: dataframe groupby with totals for certain fields
Post: RE: dataframe groupby with totals for certain fiel...

(Oct-19-2020, 12:21 AM)scidam Wrote: Your for-loop iterates over two items (or a few number of columns)... I don't understand why it is expensive (probably, copying and concatenating huge df's are e...
mikisDeWitte Data Science 4 2,638 Oct-22-2020, 11:32 AM
    Thread: dataframe groupby with totals for certain fields
Post: dataframe groupby with totals for certain fields

Hello, I am frequently required to calculate stuff for a number of dataframe columns, but with totals included. I know I can ignore a specific dimension using the transform function (https://stackove...
mikisDeWitte Data Science 4 2,638 Oct-16-2020, 11:09 AM

User Panel Messages

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