Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: how to create subplots in for loop?
Post: how to create subplots in for loop?

I would like to create a subplot for every column in the dataframe but I am not able to achieve it when I tried to use the code below fig = plt.figure() # Extrapolate each column for col in df.column...
python_newbie09 General Coding Help 1 5,897 Sep-25-2019, 01:28 PM
    Thread: how to fit an exponential function to multiple data
Post: how to fit an exponential function to multiple dat...

I would like to fit an exponential function based on data points of more than one trend. Is this possible? The code below creates a fit for every column in the table but if I want to group these colum...
python_newbie09 Data Science 1 2,832 Sep-21-2019, 11:24 AM
    Thread: How to add a few empty rows into a pandas dataframe
Post: RE: How to add a few empty rows into a pandas data...

(Sep-19-2019, 01:37 AM)scidam Wrote: You don't need to iterate over all columns, just do something like this df.reindex(df.index.tolist() + list(range(20, 40))) thanks, this worked!
python_newbie09 Data Science 2 16,331 Sep-20-2019, 08:52 AM
    Thread: How to add a few empty rows into a pandas dataframe
Post: How to add a few empty rows into a pandas datafram...

Hi, so far the examples I have found seems to only add 1 empty row to an existing dataframe but what if I have a specified number of empty rows that I want to add to a dataframe, how can this be done?...
python_newbie09 Data Science 2 16,331 Sep-18-2019, 07:20 PM
    Thread: how to get x values based on y-axis values from curvefit function
Post: how to get x values based on y-axis values from cu...

Hi, I have fitted a function for extrapolation and now I would like to get the x value when y is of a certain value. How do I get this? def func(x, b1, b2): return b1*np.exp(-b2*(x)) x = np.arr...
python_newbie09 Data Science 1 3,274 Sep-18-2019, 08:20 AM
    Thread: Counting number of occurrences of a single digit in a list
Post: RE: Counting number of occurrences of a single dig...

(Aug-07-2019, 06:49 PM)DeaD_EyE Wrote: If the data is very big (does not fit in memory or does not fit on your hard drive, you often have with frameworks a kind of generator or "magic" iterator, whi...
python_newbie09 General Coding Help 12 5,503 Aug-12-2019, 11:10 AM
    Thread: Counting number of occurrences of a single digit in a list
Post: RE: Counting number of occurrences of a single dig...

(Aug-07-2019, 01:35 PM)python_newbie09 Wrote: (Aug-07-2019, 01:26 PM)paul18fr Wrote: habit coming from Mathlab (BTW it has no consequence) I didn't understand that you want to get the number of o...
python_newbie09 General Coding Help 12 5,503 Aug-07-2019, 03:25 PM
    Thread: Counting number of occurrences of a single digit in a list
Post: RE: Counting number of occurrences of a single dig...

(Aug-07-2019, 01:26 PM)paul18fr Wrote: (Aug-07-2019, 01:12 PM)ThomasL Wrote: please explain the usage of ; at the end of each line This is python and not javascript!habit coming from Mathlab (BTW ...
python_newbie09 General Coding Help 12 5,503 Aug-07-2019, 01:35 PM
    Thread: Counting number of occurrences of a single digit in a list
Post: RE: Counting number of occurrences of a single dig...

(Aug-07-2019, 12:17 PM)paul18fr Wrote: is it what you're looking for? (just adapt to your case) n = 600; A = np.random.randint(100, size = (n,1), dtype = np.int); loc = np.where(A == 85); loc_exact ...
python_newbie09 General Coding Help 12 5,503 Aug-07-2019, 01:04 PM
    Thread: Counting number of occurrences of a single digit in a list
Post: Counting number of occurrences of a single digit i...

My data is as below: [0,1,1,1,1,2,2,2,...85,85,85,80,80,80,...0,1,1,1,2,2,2,....85,85,95,80,80,80,...] I want to be able to count how many times no 85 occurred and in this case it should return twic...
python_newbie09 General Coding Help 12 5,503 Aug-07-2019, 09:16 AM
    Thread: How to convert different timestamp formats?
Post: RE: How to convert different timestamp formats?

(Aug-05-2019, 06:36 PM)buran Wrote: in excel epoch is 1 January 1900, i.e. the whole number is days after 31.12.1899 the reason why you need to add 30 December 1899, not 31st is an known error in ex...
python_newbie09 General Coding Help 12 6,858 Aug-05-2019, 06:37 PM
    Thread: How to convert different timestamp formats?
Post: RE: How to convert different timestamp formats?

(Aug-05-2019, 05:56 PM)buran Wrote: (Aug-05-2019, 05:54 PM)python_newbie09 Wrote: timestamp has a different encoding compared to the first one and that's what I am trying to figure out now. They a...
python_newbie09 General Coding Help 12 6,858 Aug-05-2019, 06:00 PM
    Thread: How to convert different timestamp formats?
Post: RE: How to convert different timestamp formats?

(Aug-05-2019, 05:50 PM)ichabod801 Wrote: I would say this is because the second one is using a different starting point. The first one, if it is getting the correct date with fromordinal, is the day...
python_newbie09 General Coding Help 12 6,858 Aug-05-2019, 05:54 PM
    Thread: How to convert different timestamp formats?
Post: RE: How to convert different timestamp formats?

I am getting the same result for the first timestamp using this command in matlab t = datetime(735510.451215,'ConvertFrom','datenum') 03-Oct-2013 10:49:44 for the second timestamp i am getting a wei...
python_newbie09 General Coding Help 12 6,858 Aug-05-2019, 05:52 PM
    Thread: How to convert different timestamp formats?
Post: RE: How to convert different timestamp formats?

(Aug-05-2019, 03:23 PM)buran Wrote: for unix timepstamp epoch is January 1st 1970 (UTC). in your code you use datetime.fromordinal: Quote:Return the datetime corresponding to the proleptic Gregorian...
python_newbie09 General Coding Help 12 6,858 Aug-05-2019, 05:37 PM
    Thread: How to convert different timestamp formats?
Post: How to convert different timestamp formats?

I have timestamp values of different format. For one format, I used the function below and it worked. The original timestamp value is this format: 735510.451215 The other file has a timestamp value in...
python_newbie09 General Coding Help 12 6,858 Aug-05-2019, 01:55 PM
    Thread: Error -3 when opening matlab file in python
Post: Error -3 when opening matlab file in python

I am using the method below to open matlab files but for some files, I am getting different versions of error -3 mat = sio.loadmat(i, verify_compressed_data_integrity=False)Error mio5_utils.pyx in s...
python_newbie09 General Coding Help 0 2,291 Aug-02-2019, 11:51 AM
    Thread: Group files according to first few characters in filename
Post: RE: Group files according to first few characters ...

(Aug-01-2019, 08:23 PM)cvsae Wrote: (Aug-01-2019, 06:39 PM)python_newbie09 Wrote: My directory and file structure is as below Main_Folder --SubFolder1 ---aaa_001 ---bbb_002 --SunFolder2 ---aaa_00...
python_newbie09 General Coding Help 7 4,700 Aug-02-2019, 05:41 AM
    Thread: Group files according to first few characters in filename
Post: RE: Group files according to first few characters ...

(Aug-01-2019, 11:32 AM)Friend Wrote: i don't know why this shouldn't work, what exactly didn't work by using 'startswith': if filename.startswith('...') # your five lettersYeah, an example ...
python_newbie09 General Coding Help 7 4,700 Aug-01-2019, 06:39 PM
    Thread: Group files according to first few characters in filename
Post: Group files according to first few characters in f...

I used the script below that worked for one set of files that had the same name in different folders but for this second set of files, it only shares the same first five characters across the folders ...
python_newbie09 General Coding Help 7 4,700 Aug-01-2019, 10:36 AM

User Panel Messages

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