Re: Help on ctypes.POINTER for Python array

2023-05-11 Thread Jason Qian via Python-list
Awesome, thanks! On Thu, May 11, 2023 at 1:47 PM Eryk Sun wrote: > On 5/11/23, Jason Qian via Python-list wrote: > > > > in the Python, I have a array of string > > var_array=["Opt1=DG","Opt1=DG2"] > > I need to call c library and pass var_arra

Re: Help on ctypes.POINTER for Python array

2023-05-11 Thread Eryk Sun
On 5/11/23, Jason Qian via Python-list wrote: > > in the Python, I have a array of string > var_array=["Opt1=DG","Opt1=DG2"] > I need to call c library and pass var_array as parameter > In the argtypes, how do I set up ctypes.POINTER(???) for var_array?

Re: Help on ctypes.POINTER for Python array

2023-05-11 Thread Jim Schwartz
10:00 AM, Jason Qian via Python-list > wrote: > > Hi, > > Need some help, > > in the Python, I have a array of string > > var_array=["Opt1=DG","Opt1=DG2"] > > I need to call c library and pass var_array as parameter > > In the

Help on ctypes.POINTER for Python array

2023-05-11 Thread Jason Qian via Python-list
Hi, Need some help, in the Python, I have a array of string var_array=["Opt1=DG","Opt1=DG2"] I need to call c library and pass var_array as parameter In the argtypes, how do I set up ctypes.POINTER(???) for var_array? func.argtypes=[ctypes.c_void_p,ctypes.c

Re: basic question on loop & type casting / list/str/array

2022-03-16 Thread Python
Kiran Kumar wrote: Hi. Pls check on below poython 3.9.x code & suggest how can i keep the string intactst in 2nd loop... ? these are aws ec2 ids Don't loop through it then. -- https://mail.python.org/mailman/listinfo/python-list

basic question on loop & type casting / list/str/array

2022-03-16 Thread Kiran Kumar
Hi. Pls check on below poython 3.9.x code & suggest how can i keep the string intactst in 2nd loop... ? these are aws ec2 ids >>> INSTANCE_ID = ['i-0dccf1ede229ce1','i-0285506fee62051'] >>> for i in INSTANCE_ID: ... print (i) ... i-0dccf1ede229ce1 i-0285506fee62051 >>> >>> >>> >>> for i in IN

RE: ctypes on Windows question: How to access an array of uint32_t exported from a DLL?

2021-06-07 Thread pjfarley3
> -Original Message- > From: Eryk Sun > Sent: Monday, June 7, 2021 12:34 PM > To: python-list@python.org > Cc: pjfarl...@earthlink.net > Subject: Re: ctypes on Windows question: How to access an array of uint32_t > exported from a DLL? > > On 6/6/21, pjf

Re: ctypes on Windows question: How to access an array of uint32_t exported from a DLL?

2021-06-07 Thread Eryk Sun
On 6/6/21, pjfarl...@earthlink.net wrote: > > On a Windows 10 platform (python 3.8.9 and 3.9.5), how do I use ctypes to > access an array of uint32_t's exported from a DLL? > ... > __declspec(dllexport) extern uint32_t array_name[128]; A ctypes data type has an in_dll() met

ctypes on Windows question: How to access an array of uint32_t exported from a DLL?

2021-06-06 Thread pjfarley3
On a Windows 10 platform (python 3.8.9 and 3.9.5), how do I use ctypes to access an array of uint32_t's exported from a DLL? The array (after various #define's are resolved) is defined as: __declspec(dllexport) extern uint32_t array_name[128]; I have read and re-read

RE: Why can't numpy array be restored to saved value?

2020-11-26 Thread pjfarley3
> -Original Message- > From: Christian Gollwitzer > Sent: Thursday, November 26, 2020 3:26 AM > To: python-list@python.org > Subject: Re: Why can't numpy array be restored to saved value? > > Am 25.11.20 um 07:47 schrieb pjfarl...@earthlink.net: > > Why is

RE: Why can't numpy array be restored to saved value?

2020-11-26 Thread pjfarley3
> -Original Message- > From: Greg Ewing > Sent: Thursday, November 26, 2020 12:01 AM > To: python-list@python.org > Subject: Re: Why can't numpy array be restored to saved value? > > On 25/11/20 7:47 pm, pjfarl...@earthlink.net wrote: > > Why isn'

Re: Why can't numpy array be restored to saved value?

2020-11-26 Thread Christian Gollwitzer
Am 25.11.20 um 07:47 schrieb pjfarl...@earthlink.net: Why isn't the final value of the numpy array npary in the following code the same as the initial value before some but not all elements of the array were changed to a new value? I know I am missing something basic here. I thou

Re: Why can't numpy array be restored to saved value?

2020-11-25 Thread Greg Ewing
On 25/11/20 7:47 pm, pjfarl...@earthlink.net wrote: Why isn't the final value of the numpy array npary in the following code the same as the initial value before some but not all elements of the array were changed to a new value? Slicing a numpy array doesn't copy anything, it just

RE: Why can't numpy array be restored to saved value?

2020-11-25 Thread pjfarley3
asz, asz], 0, dtype=np.int32) print("Array before change=\n{}".format(npary)) svary = np.copy(npary, order='C') npary[1:-1, 1:-1, 1:-1] = 1 print("Array after change=\n{}".format(npary)) npary = svary print("Array after restore=\n{}".format(npary)) --- nptest.

Why can't numpy array be restored to saved value?

2020-11-24 Thread pjfarley3
Why isn't the final value of the numpy array npary in the following code the same as the initial value before some but not all elements of the array were changed to a new value? I know I am missing something basic here. I thought I understood the concepts of immutable vs mutable value

Re: numpy array question

2020-04-02 Thread Peter Otten
jagmit sandhu wrote: > python newbie. I can't understand the following about numpy arrays: > > x = np.array([[0, 1],[2,3],[4,5],[6,7]]) > x > array([[0, 1], >[2, 3], >[4, 5], >[6, 7]]) > x.shape > (4, 2) > y = x[:,0] > y > arra

Re: numpy array question

2020-04-02 Thread edmondo . giovannozzi
Il giorno giovedì 2 aprile 2020 06:30:22 UTC+2, jagmit sandhu ha scritto: > python newbie. I can't understand the following about numpy arrays: > > x = np.array([[0, 1],[2,3],[4,5],[6,7]]) > x > array([[0, 1], >[2, 3], >[4, 5], >[6, 7]]) > x

numpy array question

2020-04-01 Thread jagmit sandhu
python newbie. I can't understand the following about numpy arrays: x = np.array([[0, 1],[2,3],[4,5],[6,7]]) x array([[0, 1], [2, 3], [4, 5], [6, 7]]) x.shape (4, 2) y = x[:,0] y array([0, 2, 4, 6]) y.shape (4,) Why is the shape for y reported as (4,) ? I expected it to

Re: array and struct 64-bit Linux change in behavior Python 3.7 and 2.7

2019-12-07 Thread Peter J. Holzer
On 2019-12-02 09:55:16 -0800, Rob Gaddi wrote: > The struct situation is, as you said, a bit different. I believe that with > the default native alignment @, you're seeing 4-byte data padded to an > 8-byte alignment, not 8-byte data. Nope. That's really an 8 byte long: Python 3.7.3 (default,

Re: array and struct 64-bit Linux change in behavior Python 3.7 and 2.7

2019-12-07 Thread Peter J. Holzer
On 2019-12-05 09:27:43 +, Barry Scott wrote: > On 3 Dec 2019, at 01:50, Richard Damon wrote: > > On 12/2/19 4:25 PM, Barry Scott wrote: > > x=struct.pack('L',0x102030405) > > x > >> b'\x05\x04\x03\x02\x01\x00\x00\x00' > >> > >> Given I have exact control with b, h, i, and q but L is n

Re: array and struct 64-bit Linux change in behavior Python 3.7 and 2.7

2019-12-05 Thread Barry Scott
> On 3 Dec 2019, at 01:50, Richard Damon wrote: > > On 12/2/19 4:25 PM, Barry Scott wrote: >> >>> On 2 Dec 2019, at 17:55, Rob Gaddi >>> wrote: >>> >>> On 12/2/19 9:26 AM, Chris Clark wrote: >>>> Test case: >>

Re: array and struct 64-bit Linux change in behavior Python 3.7 and 2.7

2019-12-03 Thread Chris Angelico
pical > but *not* guaranteed sizes", that would be more clear. > I think array.array() is possibly the wrong tool for this job. If you have a collection of bytes from some well-defined source (eg you're parsing a file in a known format), struct is better suited to it, because it's

RE: array and struct 64-bit Linux change in behavior Python 3.7 and 2.7

2019-12-03 Thread Chris Clark
I'm probing I and L to determine size before using them for real). I don’t think U prefix would work as array really only accepts a single specifier. If array was to be updated to use multiple character specifiers I would recommend matching the struct specifier (which it is close to at the m

Re: array and struct 64-bit Linux change in behavior Python 3.7 and 2.7

2019-12-03 Thread Rob Gaddi
On 12/2/19 5:50 PM, Richard Damon wrote: Perhaps array could be extended so that it took '4' for a 4 byte integer and '8' for an 8 byte integer (maybe 'U4' and 'U8' for unsigned). Might as well also allow 1 and 2 for completeness for char and short (b

Re: array and struct 64-bit Linux change in behavior Python 3.7 and 2.7

2019-12-02 Thread Richard Damon
On 12/2/19 4:25 PM, Barry Scott wrote: > >> On 2 Dec 2019, at 17:55, Rob Gaddi wrote: >> >> On 12/2/19 9:26 AM, Chris Clark wrote: >>> Test case: >>>import array >>>array.array('L', [0]) >>> # x

Re: array and struct 64-bit Linux change in behavior Python 3.7 and 2.7

2019-12-02 Thread Christian Heimes
On 02/12/2019 22.25, Barry Scott wrote: > > >> On 2 Dec 2019, at 17:55, Rob Gaddi wrote: >> >> On 12/2/19 9:26 AM, Chris Clark wrote: >>> Test case: >>>import array >>>array.array('L', [0]) >&g

Re: array and struct 64-bit Linux change in behavior Python 3.7 and 2.7

2019-12-02 Thread Barry Scott
> On 2 Dec 2019, at 17:55, Rob Gaddi wrote: > > On 12/2/19 9:26 AM, Chris Clark wrote: >> Test case: >> import array >>array.array('L', [0]) >> # x.itemsize == 8 rather than 4 >> This works fine (returns 4)

Re: array and struct 64-bit Linux change in behavior Python 3.7 and 2.7

2019-12-02 Thread Rob Gaddi
On 12/2/19 9:26 AM, Chris Clark wrote: Test case: import array array.array('L', [0]) # x.itemsize == 8 rather than 4 This works fine (returns 4) under Windows Python 3.7.3 64-bit build. Under Ubuntu; Python 2.7.15rc1, 3.6.5, 3.70b3 64-bit this

Re: array and struct 64-bit Linux change in behavior Python 3.7 and 2.7

2019-12-02 Thread Richard Damon
On Dec 2, 2019, at 12:32 PM, Chris Clark wrote: > > Test case: > > import array > array.array('L', [0]) > # x.itemsize == 8 rather than 4 > > This works fine (returns 4) under Windows Python 3.7.3 64-bit build. > > Under

array and struct 64-bit Linux change in behavior Python 3.7 and 2.7

2019-12-02 Thread Chris Clark
Test case: import array array.array('L', [0]) # x.itemsize == 8 rather than 4 This works fine (returns 4) under Windows Python 3.7.3 64-bit build. Under Ubuntu; Python 2.7.15rc1, 3.6.5, 3.70b3 64-bit this returns 8. Documentation at https://docs.py

Anyone has good understanding of how model base agents work in 2D array? --AIMA repository

2019-10-06 Thread krishna singh
array? -- https://mail.python.org/mailman/listinfo/python-list

Re: Most efficient way to replace ", " with "." in a array and/or dataframe

2019-09-23 Thread Piet van Oostrum
Markos writes: [...] >>> Please, any comments or tip? >> data = pd.read_csv ('table.csv', sep = ',', skiprows = 1, decimal=b',', >> skipinitialspace=True) >> > Thank you for the tip. > > I didn't realize that I could av

Re: Most efficient way to replace ", " with "." in a array and/or dataframe

2019-09-22 Thread Markos
,280" 3, "0,152", "0,200", "0,280" I open as dataframe with the command: data = pd.read_csv ('table.csv', sep = ',', skiprows = 1) [snip] Also I'm also wondering if there would be any benefit of making this modification in datafra

Re: Most efficient way to replace ", " with "." in a array and/or dataframe

2019-09-22 Thread Richard Damon
nd: >>> >>> data = pd.read_csv ('table.csv', sep = ',', skiprows = 1) >>> >> [snip] >> >>> Also I'm also wondering if there would be any benefit of making this >>> modification in dataframe before extracting the nume

Re: Most efficient way to replace ", " with "." in a array and/or dataframe

2019-09-22 Thread Markos
,280" 3, "0,152", "0,200", "0,280" I open as dataframe with the command: data = pd.read_csv ('table.csv', sep = ',', skiprows = 1) [snip] Also I'm also wondering if there would be any benefit of making this modification in dataframe bef

Re: Most efficient way to replace ", " with "." in a array and/or dataframe

2019-09-22 Thread Piet van Oostrum
t; > 3, "0,152", "0,200", "0,280" > > I open as dataframe with the command: > > data = pd.read_csv ('table.csv', sep = ',', skiprows = 1) > [snip] > Also I'm also wondering if there would be any benefit of making this > modifi

Re: [Tutor] Most efficient way to replace ", " with "." in a array and/or dataframe

2019-09-22 Thread Eryk Sun
On 9/22/19, Albert-Jan Roskam wrote: > > Do you think it's a deliberate design choice that decimal and thousands > where used here as params, and not a 'locale' param? It seems nice to be > able to specify e.g. locale='dutch' and then all the right lc_numeric, > lc_monetary, lc_time where used. Or

Re: [Tutor] Most efficient way to replace ", " with "." in a array and/or dataframe

2019-09-22 Thread Cameron Simpson
On 22Sep2019 07:39, Albert-Jan Roskam wrote: On 22 Sep 2019 04:27, Cameron Simpson wrote: On 21Sep2019 20:42, Markos wrote: I have a table.csv file with the following structure: , Polyarene conc ,, mg L-1 ,,, Spectrum, Py, Ace, Anth, 1, "0,456", "0,120", "0,168" 2, "0,456", "0,040", "0,2

Re: [Tutor] Most efficient way to replace ", " with "." in a array and/or dataframe

2019-09-22 Thread Albert-Jan Roskam
On 22 Sep 2019 04:27, Cameron Simpson wrote: On 21Sep2019 20:42, Markos wrote: >I have a table.csv file with the following structure: > >, Polyarene conc ,, mg L-1 ,,, >Spectrum, Py, Ace, Anth, >1, "0,456", "0,120", "0,168" >2, "0,456", "0,040", "0,280" >3, "0,152", "0,200", "0,280" > >I

Re: [Tutor] Most efficient way to replace ", " with "." in a array and/or dataframe

2019-09-21 Thread Cameron Simpson
On 21Sep2019 20:42, Markos wrote: I have a table.csv file with the following structure: , Polyarene conc ,, mg L-1 ,,, Spectrum, Py, Ace, Anth, 1, "0,456", "0,120", "0,168" 2, "0,456", "0,040", "0,280" 3, "0,152", "0,200", "0,280" I open as dataframe with the command: data = pd.read_csv ('

Re: Most efficient way to replace "," with "." in a array and/or dataframe

2019-09-21 Thread MRAB
2", "0,200", "0,280" I open as dataframe with the command: data = pd.read_csv ('table.csv', sep = ',', skiprows = 1) and the variable "data" has the structure: Spectrum,  Py,  Ace, Anth, 0  1 0,456  0,120  0,168 1  2 0,456 0,040 0,280

Most efficient way to replace "," with "." in a array and/or dataframe

2019-09-21 Thread Markos
t;0,280" I open as dataframe with the command: data = pd.read_csv ('table.csv', sep = ',', skiprows = 1) and the variable "data" has the structure: Spectrum,  Py,  Ace, Anth, 0  1 0,456  0,120  0,168 1  2 0,456 0,040 0,280 2  3 0,152 0,200 0,280 I c

Re: numpy array - convert hex to int

2019-09-10 Thread Piet van Oostrum
Sharan Basappa writes: > On Sunday, 8 September 2019 11:16:52 UTC-4, Luciano Ramalho wrote: >> >>> int('C0FFEE', 16) >> 12648430 >> >> There you go! >> >> On Sun, Sep 8, 2019 at 12:02 PM Sharan Basappa >> wrote: >> >

Re: numpy array - convert hex to int

2019-09-09 Thread Sharan Basappa
On Sunday, 8 September 2019 11:16:52 UTC-4, Luciano Ramalho wrote: > >>> int('C0FFEE', 16) > 12648430 > > There you go! > > On Sun, Sep 8, 2019 at 12:02 PM Sharan Basappa > wrote: > > > > I have a numpy array that has data in the form o

Re: numpy array - convert hex to int

2019-09-08 Thread Luciano Ramalho
>>> int('C0FFEE', 16) 12648430 There you go! On Sun, Sep 8, 2019 at 12:02 PM Sharan Basappa wrote: > > I have a numpy array that has data in the form of hex. > I would like to convert that into decimal/integer. > Need suggestions please. > -- > https://ma

numpy array - convert hex to int

2019-09-08 Thread Sharan Basappa
I have a numpy array that has data in the form of hex. I would like to convert that into decimal/integer. Need suggestions please. -- https://mail.python.org/mailman/listinfo/python-list

Re: Difference between array( [1,0,1] ) and array( [ [1,0,1] ] )

2019-06-22 Thread Markos
. I think I understood a little bit more. The number of nested brackets indicates the number of array dimensions. the vector ( [1,2] ) is one-dimensional, but the vector ( [ [1,2] ] ) is two-dimensional. v_1 = np.array( [1,2] ) > v_1.shape (2,) > v_1 v_1 > v_1 array( [1, 2] ) > v_

Re: Difference between array( [1,0,1] ) and array( [ [1,0,1] ] )

2019-06-21 Thread MRAB
f vector_2 is: vector_2.shape (1, 3) The transpose on vector_1 don't work: vector_1.T array([1, 0, 1]) But the transpose method in vector_2 works fine: vector_2.T array([[1],    [0],    [1]]) I thought that both vectors would be treated as an matrix of 1 row and 3 col

Re: Difference between array( [1,0,1] ) and array( [ [1,0,1] ] )

2019-06-21 Thread edmondo . giovannozzi
Keep also in mind that numpy is quite different from Matlab. In Matlab every vaiable is a matrix of at least 2 dimensions. This is not the case of numpy (and is not the case in Fortran too). every array can have a different number of dimensions. The transposition of an array with just 1

Re: Difference between array( [1,0,1] ) and array( [ [1,0,1] ] )

2019-06-21 Thread edmondo . giovannozzi
Every array in numpy has a number of dimensions, "np.array" is a function that can create an array numpy given a list. when you write vector_1 = np.array([1,2,1]) you are passing a list of number to thet function array that will create a 1D array. As you are showing: vector_1.

Re: Difference between array( [1,0,1] ) and array( [ [1,0,1] ] )

2019-06-21 Thread Stephen Tucker
) > > But the shape of vector_2 is: > > >>> vector_2.shape > (1, 3) > > The transpose on vector_1 don't work: > > >>> vector_1.T > array([1, 0, 1]) > > But the transpose method in vector_2 works fine: > > >>> vector_2.T > arra

Difference between array( [1,0,1] ) and array( [ [1,0,1] ] )

2019-06-20 Thread Markos
1, 3) The transpose on vector_1 don't work: vector_1.T array([1, 0, 1]) But the transpose method in vector_2 works fine: vector_2.T array([[1],    [0],    [1]]) I thought that both vectors would be treated as an matrix of 1 row and 3 columns. Why this difference? Any tip? Th

Re: How to split a list type array into float array?

2019-05-21 Thread Ervin Hegedüs
> 27.1019 26.9223 26.7426 26.5630 26.3834 26.2037 26.0241 > 25.8445 25.6649 25.4852 25.3056 25.1260 24.9463 24.7667 24.5871 > 24.4075 24.2278 24.0482 -0.2616 -0.3215 -0.3813 -0.4412\n'] > > Can anyone help me split as a float array?

Re: How to split a list type array into float array?

2019-05-21 Thread Alister via Python-list
7.1019 26.9223 26.7426 26.5630 26.3834 26.2037 > 26.0241 25.8445 25.6649 25.4852 25.3056 25.1260 24.9463 > 24.7667 24.5871 24.4075 24.2278 24.0482 -0.2616 -0.3215 > -0.3813 -0.4412\n'] > > Can anyone help me split as a float array? >

How to split a list type array into float array?

2019-05-21 Thread Madhavan Bomidi
.4852 25.3056 25.1260 24.9463 24.7667 24.5871 24.4075 24.2278 24.0482 -0.2616 -0.3215 -0.3813 -0.4412\n'] Can anyone help me split as a float array? Thanks in advance -- https://mail.python.org/mailman/listinfo/python-list

Re: How to append horizontally the data array from the FOR loop?

2019-05-10 Thread Cameron Simpson
On 10May2019 08:08, Madhavan Bomidi wrote: I have to append requisite data matrix from multiple files into a single variable using FOR loop. outData = []; for file in fileList: allData = # an array of nrows and ncols. outData = [outData; allData] # in MATLAB

Re: How to append horizontally the data array from the FOR loop?

2019-05-10 Thread Rhodri James
On 10/05/2019 16:08, Madhavan Bomidi wrote: Hi, I have to append requisite data matrix from multiple files into a single variable using FOR loop. outData = []; for file in fileList: allData = # an array of nrows and ncols. outData

How to append horizontally the data array from the FOR loop?

2019-05-10 Thread Madhavan Bomidi
Hi, I have to append requisite data matrix from multiple files into a single variable using FOR loop. outData = []; for file in fileList: allData = # an array of nrows and ncols. outData = [outData; allData] # in MATLAB While the ncols are

Re: array of characters?

2019-03-22 Thread Ian Kelly
I don't know the answer, and PEP 393 doesn't talk about the array('u') deprecation directly. But it seems to me that with Py_UNICODE going away this array type code would have to be completely reimplemented, and also at that point array('u') is just equivalent

Re: array of characters?

2019-03-22 Thread Gregory Ewing
Paul Rubin wrote: - array('u') works but it is deprecated, and (not sure) the doc page says the object size is 2 bytes, so it may only handle BMP characters The docs actually say "Depending on the platform, it can be 16 bits or 32 bits". With Python 3.5 on MacOSX, it se

Re: How can I find the indices of an array with float values in python?

2019-01-10 Thread Madhavan Bomidi
Thank you all for various ways of finding the indices. -- https://mail.python.org/mailman/listinfo/python-list

RE: How can I find the indices of an array with float values in python?

2019-01-10 Thread Avi Gross
, you have an array of numbers. (numpy style) and you want a way to designate a subset of those numbers that meet your criterion. Your criterion is a compound criterion that needs refining. You want numbers between 0 and 15. Are you including one or both endpoints? Any answers you choose to use will

Re: How can I find the indices of an array with float values in python?

2019-01-10 Thread MRAB
On 2019-01-10 17:05, Madhavan Bomidi wrote: Sorry for re-posting with a correction. I have an array (numpy.ndarray) with shape (1500L,) as below: x = array([ 3.e+01, 6.e+01, 9.e+01, ..., 4.4940e+04, 4.4970e+04, 4.5000e+04]) Now, I

Re: How can I find the indices of an array with float values in python?

2019-01-10 Thread Rob Gaddi
On 1/10/19 9:25 AM, Peter Otten wrote: Madhavan Bomidi wrote: I have an array (numpy.ndarray) with shape (1500L,) as below: x = array([ 3.e+01, 6.e+01, 9.e+01, ..., 4.4940e+04, 4.4970e+04, 4.5000e+04]) Now, I wanted to determine the

Re: How can I find the indices of an array with float values in python?

2019-01-10 Thread Peter Otten
Madhavan Bomidi wrote: > I have an array (numpy.ndarray) with shape (1500L,) as below: > > x = array([ 3.e+01, 6.e+01, 9.e+01, ..., > 4.4940e+04, 4.4970e+04, 4.5000e+04]) > > Now, I wanted to determine the indices of the x

RE: How can I find the indices of an array with float values in python?

2019-01-10 Thread David Raymond
PM To: python-list@python.org Subject: Re: How can I find the indices of an array with float values in python? Sorry for re-posting with a correction. I have an array (numpy.ndarray) with shape (1500L,) as below: x = array([ 3.e+01, 6.e+01, 9.e+01, ..., 4.494000

Re: How can I find the indices of an array with float values in python?

2019-01-10 Thread Madhavan Bomidi
Sorry for re-posting with a correction. I have an array (numpy.ndarray) with shape (1500L,) as below: x = array([ 3.e+01, 6.e+01, 9.e+01, ..., 4.4940e+04, 4.4970e+04, 4.5000e+04]) Now, I wanted to determine the indices of the x values

How can I find the indices of an array with float values in python?

2019-01-10 Thread Madhavan Bomidi
I have an array (numpy.ndarray) with shape (1500L,) as below: x = array([ 3.e+01, 6.e+01, 9.e+01, ..., 4.4940e+04, 4.4970e+04, 4.5000e+04]) Now, I wanted to determine the indices of the x values between 0.0 and 15.0. While this is simple in

Better way to recontruct a continuous and repeated array with low time complexity?

2018-12-20 Thread lampahome
I write program to do experiment about time series(weekly) with machine learning. I record changes of everyday of each ID and Count. I read the csv as dataset like below: ID, Count 1,30 // First Day 2,33 3,45 4,11 5,66 7,88 1,32 // 2nd Day 2,35 3,55 4,21 5,36 7,48 I have two array X, y. I want to

Re: Can't import array in 3.7 python version

2018-09-18 Thread MRAB
If that's not the problem, then you'll need to provide some more details. Copy the traceback and post it here. On Tue, 18 Sep 2018, 23:07 Cruey Cruel, wrote: Hi team, Am facing issue in importing array. I use alatest version of pythonide and pycharm. Telle how can I fix this. T

Re: Can't import array in 3.7 python version

2018-09-18 Thread Cruey Cruel
I have subscribe to python list, please provide me any resolution forpreviois below email On Tue, 18 Sep 2018, 23:07 Cruey Cruel, wrote: > Hi team, > Am facing issue in importing array. > > I use alatest version of pythonide and pycharm. > > Telle how can I fix this. >

Fitting cubic spline on 2D array

2018-05-30 Thread Priya Singh
Hello all, Can anyone tell me how can I get the functional form of the fitted cubic spline function on to my 2D array? For eg. when we fit the Gaussian on to an array so we have the functional form with the parameters best fitted to my data likewise how can we do for the cubic spline function

Re: Numpy array

2018-05-21 Thread Rob Gaddi
On 05/18/2018 09:50 PM, Sharan Basappa wrote: This is regarding numpy array. I am a bit confused how parts of the array are being accessed in the example below. 1 import scipy as sp 2 data = sp.genfromtxt("web_traffic.tsv", delimiter="\t") 3 print(data[:10]) 4 x = data

Re: Numpy array

2018-05-20 Thread Gary Herron
The "indexing" page of the documentation might help you with this: https://docs.scipy.org/doc/numpy-1.14.0/reference/arrays.indexing.html On 05/18/2018 09:50 PM, sharan.basa...@gmail.com wrote: This is regarding numpy array. I am a bit confused how parts of the array are being a

Numpy array

2018-05-18 Thread Sharan Basappa
This is regarding numpy array. I am a bit confused how parts of the array are being accessed in the example below. 1 import scipy as sp 2 data = sp.genfromtxt("web_traffic.tsv", delimiter="\t") 3 print(data[:10]) 4 x = data[:,0] 5 y = data[:,1] Apparently, line 3 prints the

How to save multi-dimentional array values into CSV/Test file

2018-04-17 Thread shalu . ashu50
Hi All, I am using winpy 6.3 I have this array: code: clt_subset = nc.variables['clt'][:,latli:latui , lonli:lonui] print(clt_subset): [[[ 96.07967377 32.581317930.86773872 ..., 99.6185 99.7711 99.7711] [ 93.75789642 86.78536987 46.51786423 ..., 9

RE: Python regex pattern from array of hex chars

2018-04-13 Thread Joseph L. Casale
-Original Message- From: Python-list On Behalf Of MRAB Sent: Friday, April 13, 2018 12:05 PM To: python-list@python.org Subject: Re: Python regex pattern from array of hex chars > Use re.escape: > > regex = re.compile('[^{}]+'.format(re.escape(''.join

Re: Python regex pattern from array of hex chars

2018-04-13 Thread MRAB
On 2018-04-13 18:28, Joseph L. Casale wrote: I have an array of hex chars which designate required characters. and one happens to be \x5C or "\". What foo is required to build the pattern to exclude all but: regex = re.compile('[^{}]+'.format(''.join(c for c in c

Python regex pattern from array of hex chars

2018-04-13 Thread Joseph L. Casale
I have an array of hex chars which designate required characters. and one happens to be \x5C or "\". What foo is required to build the pattern to exclude all but: regex = re.compile('[^{}]+'.format(''.join(c for c in character_class))) I would use that in a re.sub t

Re: Problem in defining multidimensional array matrix and regression

2017-11-19 Thread ROGER GRAYDON CHRISTMAN
On Sun, 19 Nov 2017, shalu.ash...@gmail.com wrote: > Hi, All, > >I have 6 variables in CSV file. One is rainfall (dependent, at >y-axis) and others are predictors (at x). I want to do multiple >regression and create a correlation matrix between rainfall (y) and >predictors (x; n1=5). Thus I want to

Re: Problem in defining multidimensional array matrix and regression

2017-11-19 Thread Thomas Jollans
On 19/11/17 18:55, shalu.ash...@gmail.com wrote: > Hello Peter, > > Many thanks for your suggestion. > Now I am using Pandas & > I already did that but now I need to make a multi-dimensional array for > reading all variables (5 in this case) at one x-axis, so I c

Re: Problem in defining multidimensional array matrix and regression

2017-11-19 Thread Ben Finney
org/wiki/Posting_style#Interleaved_style>, so that your message reads like a proper discussion. (This message is an example of that.) * Show the code you wrote where you “already did that”, and say what happened different from what you expected. > but now I need to make a multi-dimensi

Re: Problem in defining multidimensional array matrix and regression

2017-11-19 Thread shalu . ashu50
Hello Peter, Many thanks for your suggestion. Now I am using Pandas & I already did that but now I need to make a multi-dimensional array for reading all variables (5 in this case) at one x-axis, so I can perform multiple regression analysis. I am not getting how to bring all variable

Re: Problem in defining multidimensional array matrix and regression

2017-11-19 Thread Peter Otten
t, Nov 17 2016, 01:08:31) [GCC 4.8.4] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import numpy >>> rf = numpy.genfromtxt("rainfall.txt", names=True) >>> rf["RF"] array([

Problem in defining multidimensional array matrix and regression

2017-11-19 Thread shalu . ashu50
Hi, All, I have 6 variables in CSV file. One is rainfall (dependent, at y-axis) and others are predictors (at x). I want to do multiple regression and create a correlation matrix between rainfall (y) and predictors (x; n1=5). Thus I want to read rainfall as a separate variable and others in sep

Re: Array column separations for beginners

2017-05-01 Thread katarin . bern
Thanks very much, it was pretty easy and now it works :) -- https://mail.python.org/mailman/listinfo/python-list

Re: Array column separations for beginners

2017-05-01 Thread Rob Gaddi
On 05/01/2017 08:14 AM, katarin.b...@gmail.com wrote: Hi again, I am trying to subtract the minimum value from all numbers (in one array). I am using this: (array[:,1] -= np.min(array[:,1]) but I alsways have syntaxerror:invalid syntax. Do I need some import for this -=? or its something

Re: Array column separations for beginners

2017-05-01 Thread Peter Otten
katarin.b...@gmail.com wrote: > Hi again, > > I am trying to subtract the minimum value from all numbers (in one array). > I am using this: > > > (array[:,1] -= np.min(array[:,1]) but I alsways have syntaxerror:invalid > syntax. Do I need some import for this -

Re: Array column separations for beginners

2017-05-01 Thread katarin . bern
Hi again, I am trying to subtract the minimum value from all numbers (in one array). I am using this: (array[:,1] -= np.min(array[:,1]) but I alsways have syntaxerror:invalid syntax. Do I need some import for this -=? or its something else? THanks! -- https://mail.python.org/mailman

Re: Array column separations for beginners

2017-04-27 Thread breamoreboy
On Thursday, April 27, 2017 at 8:10:33 PM UTC+1, katari...@gmail.com wrote: > Thanks a lot, it helped me. > > I have new question..maybe very easy but I am trying to search on web and I > have no clue. > I have array(table) with 3 rows - x, y, y. I would like to plot graph with

Re: Array column separations for beginners

2017-04-27 Thread katarin . bern
Thanks a lot, it helped me. I have new question..maybe very easy but I am trying to search on web and I have no clue. I have array(table) with 3 rows - x, y, y. I would like to plot graph with double y axis from that table. Should I use twinxs? or does exist easier way? Thanks! -- https

Re: Array column separations for beginners

2017-04-26 Thread Rhodri James
On 26/04/17 15:04, katarin.b...@gmail.com wrote: Hi, 1. I would like to ask how can I adjust array.csv like this: ,,,-00.00014640, 0.08000, ,,,-00.00014620, 0.0, ,,,-00.00014600, 0.0, ,,,-00.00014580, 0.0, so I can have in first column -00.00014640 and in

Re: Array column separations for beginners

2017-04-26 Thread Peter Otten
katarin.b...@gmail.com wrote: > Hi, > 1. I would like to ask how can I adjust array.csv like this: > ,,,-00.00014640, 0.08000, > ,,,-00.00014620, 0.0, > ,,,-00.00014600, 0.0, > ,,,-00.00014580, 0.0, > > so I can have in first column -00.00014640 and in seco

Array column separations for beginners

2017-04-26 Thread katarin . bern
Hi, 1. I would like to ask how can I adjust array.csv like this: ,,,-00.00014640, 0.08000, ,,,-00.00014620, 0.0, ,,,-00.00014600, 0.0, ,,,-00.00014580, 0.0, so I can have in first column -00.00014640 and in second column 0.08000? (thanks, I am begginer).

Re: Python3, column names from array - numpy or pandas

2016-12-15 Thread Rhodri James
On 15/12/16 01:56, renjith madhavan wrote: I have a dataset in the below format. id A B C D E 100 1 0 0 0 0 101 0 1 1 0 0 102 1 0 0 0 0 103 0 0 0 1 1 I wo

Re: Python3, column names from array - numpy or pandas

2016-12-15 Thread renjith madhavan
Thank you for the reply. I tried that, I am trying to do this. The context is I am trying to find mapk ( k = 3 ) for this list. A, B , C, D and E are product names. If I am trying manually I will do something like this. TRUTH = [[A], [B,C], [A], [D,E]] and if my prediction is : PRED=[[B,A, D],

Re: Python3, column names from array - numpy or pandas

2016-12-14 Thread Miki Tebeka
You can do this with pandas: import pandas as pd from io import StringIO io = StringIO('''\ idABCDE 10010000 10101100 10210

Python3, column names from array - numpy or pandas

2016-12-14 Thread renjith madhavan
I have a dataset in the below format. id A B C D E 100 1 0 0 0 0 101 0 1 1 0 0 102 1 0 0 0 0 103 0 0 0 1 1 I would like to convert this into below: 100, A 1

Re: Address boundary error when trying to use Image.putdata(array) from PIL

2016-09-24 Thread MRAB
on 3.5 on Windows and I get an exception: SystemError: new style getargs format but argument is not a tuple From what I've been able to find out, the argument of 'putdata' should be a list (sequence) of tuples. A quicker way is to create a new image from the array: im = Image.fromarray(arr) -- https://mail.python.org/mailman/listinfo/python-list

Address boundary error when trying to use Image.putdata(array) from PIL

2016-09-24 Thread Tristan Trouwen
Got a signal boundary error. Steps to reproduce: open python console Python 2.7.9 (default, Jun 29 2016, 13:08:31) [GCC 4.9.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from PIL import Image >>> im = Image.open('HKJL.jpg') >>> import numpy as np >>> arr

  1   2   3   4   5   6   7   8   9   10   >