Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Using scipy.optimize: curve_fit
Post: Using scipy.optimize: curve_fit

Hey there, I would like to model exponential data by a curve_fit with scipy. The fit fits well for small x-values, but less so for bigger x-values. Is there anything I can do to improve the overall ...
ju21878436312 Data Science 0 954 Sep-24-2022, 01:15 PM
    Thread: [Solved:] How to use pd.append() ?
Post: RE: How to use pd.append() ?

thank you!
ju21878436312 General Coding Help 3 1,284 Mar-01-2022, 07:41 AM
    Thread: [Solved:] How to use pd.append() ?
Post: [Solved:] How to use pd.append() ?

Can someone tell me, why the first example of how to use pd.append() works, and the second not? # 1) This works fine: df1 = pd.DataFrame([[1, 2], [3, 4]], columns=list('AB')) df2 = pd.DataFrame([[...
ju21878436312 General Coding Help 3 1,284 Feb-28-2022, 12:15 PM
    Thread: [Solved] Delete a line in a dataframe using .reset_index() and .drop()
Post: RE: Delete a line in a dataframe

Thank you very much! **dance**
ju21878436312 General Coding Help 2 2,679 Feb-25-2022, 02:55 PM
    Thread: [Solved] Delete a line in a dataframe using .reset_index() and .drop()
Post: [Solved] Delete a line in a dataframe using .rese...

Hi out there, I'd like to delete a line in the dataframe "df_new". Why does it not work? I get the error: "KeyError: '[0] not found in axis". import pandas as pd import numpy as np data = {'x': [...
ju21878436312 General Coding Help 2 2,679 Feb-25-2022, 01:14 PM
    Thread: [solved] iteration + df.loc
Post: RE: [solved] iteration + df.loc

Thank you, I'll use your method!
ju21878436312 General Coding Help 2 1,320 Feb-15-2022, 01:59 PM
    Thread: [solved] iteration + df.loc
Post: [solved] iteration + df.loc

I'd like to iterate through the lines by a for loop. And when the condition "df['col2'] == "second"is true, I'd like to do some calculations in this line in column df["col3"], e.g. df.loc[i, "col3"] ...
ju21878436312 General Coding Help 2 1,320 Feb-15-2022, 08:14 AM
    Thread: [Solved] Matplotlib - Tricontour: how to set colorbar range
Post: RE: [Solved] Matplotlib - Tricontour: how to set c...

I found the solution by myself: via levels you can specify the exact vector for the colorbar range. levels =[0.1,0.2,0.3,0.4]
ju21878436312 General Coding Help 1 6,590 Dec-13-2021, 07:44 PM
    Thread: [Solved] Matplotlib - Tricontour: how to set colorbar range
Post: [Solved] Matplotlib - Tricontour: how to set color...

I would like to set the colorbar range, when plotting my data, using tricontour. What I have tried: vmin=0.13, vmax=0.4 to enforce min and max, but it did not show any difference. plt.clim(0.13,0...
ju21878436312 General Coding Help 1 6,590 Dec-13-2021, 07:43 PM
    Thread: Access specific value in df
Post: RE: Access specific value in df

Hi, I think the first mistake was to do a substraction between 'Timestamp' and 'str', as the error was TypeError: unsupported operand type(s) for -: 'DatetimeArray' and 'str'But if I change the 'str'...
ju21878436312 Data Science 2 2,023 Aug-18-2021, 08:24 AM
    Thread: Access specific value in df
Post: Access specific value in df

Hi there, Is there a way to assign a time difference to the whole column, from a certain row on? How do I access e.g. the value in row 2, column 0? import pandas as pd import numpy as np df = pd.re...
ju21878436312 Data Science 2 2,023 Aug-16-2021, 09:44 AM
    Thread: [Solved] df.loc: write data in certain rows
Post: RE: df.loc: write data in certain rows

I found the solution: # write data in column 'Comment', only for certain rows creates KeyError df.loc[(df['Date_Time'] >= '2021-06-10 09:50:31')&(df['Date_Time'] < '2021-06-10 09:51:00'),...
ju21878436312 General Coding Help 1 1,701 Jun-28-2021, 06:49 AM
  Lightbulb Thread: [Solved] df.loc: write data in certain rows
Post: [Solved] df.loc: write data in certain rows

I import a text file and would like to write a comment in certain rows, which I access with df.loc. However, I get the error "# When setting, missing keys are not allowed, even with .loc:". Could some...
ju21878436312 General Coding Help 1 1,701 Jun-28-2021, 06:48 AM
    Thread: Pandas datetime: add timedelta
Post: RE: Pandas datetime: add timedelta

Hi there, sorry for the late reply. The attempts did non work, as the columns were not interpreted as datetimes. I solved it this way: df = pd.read_csv('minimal_in.txt', delimiter= '\t',parse_dates=...
ju21878436312 Data Science 3 6,759 Jun-23-2021, 08:09 AM
    Thread: [solved] dataframe and read_csv
Post: RE: dataframe and read_csv

@snippsat: Thank you very much for the useful comments! **dance**
ju21878436312 General Coding Help 4 2,894 Jun-16-2021, 06:01 AM
    Thread: [solved] dataframe and read_csv
Post: RE: dataframe and read_csv

Thank you. I actually need to further evaluate the data. And if I try it directly with data, I get: data.dtypes AttributeError: 'tuple' object has no attribute 'dtypes'or data.loc[data['MyColumn2']...
ju21878436312 General Coding Help 4 2,894 Jun-15-2021, 01:26 PM
    Thread: [solved] dataframe and read_csv
Post: [solved] dataframe and read_csv

Aim: I would like to convert data, read with read_csv and convert it to a dataframe. What I've tried: 1. data = pd.read_csv(...) 2. pd.DataFrame(data) Problem: The columns are not shown in the datafr...
ju21878436312 General Coding Help 4 2,894 Jun-15-2021, 09:44 AM
    Thread: [Solved] df.to_excel: certain rows
Post: RE: df.to_excel: certain rows

(May-26-2021, 06:21 AM)perfringo Wrote: One way is to feed .to_excel with filtered dataframe. For first three rows it would be: df.iloc[:3].to_excel(writer, startrow=1, sheet_name='row_1_to_3') T...
ju21878436312 Data Science 2 3,276 Jun-15-2021, 09:32 AM
    Thread: Reset seaborn
Post: RE: Reset seaborn

(May-26-2021, 01:55 AM)Larz60+ Wrote: reset_defaults() see: https://seaborn.pydata.org/generated/sea...t_defaults Restore all RC params to default settings. reset_orig() see: https://seaborn.py...
ju21878436312 Data Science 2 5,058 Jun-15-2021, 09:31 AM
    Thread: Reset seaborn
Post: Reset seaborn

Hi there, Following some tipps I somehow changed some global settings in seaborn and I would like to reset everything concerning seaborn and matplotlib. It seems I shifted the y-axis somehow. impor...
ju21878436312 Data Science 2 5,058 May-25-2021, 05:40 PM

User Panel Messages

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