Re: Not able use installed modules

2020-05-09 Thread Bob Gailer
On May 8, 2020 2:15 PM, "boB Stepp"  wrote:
[snip]
> This may be a naive question on my part, but, as far as I can tell, most
> instructions that I have encountered for installing Python packages state
the
> installation instructions as "pip install ...", which seems to repeatedly
> lead to these type of OP questions.  Has there ever been given thought to
> changing these "standard" installation instructions to something less
error
> fraught for the newcomer/novice?

> --
> Wishing you only the best,
>
> boB Stepp

I agree. I've been using python for many many years and have been
repeatedly frustrated with pip.

Bob Gailer
-- 
https://mail.python.org/mailman/listinfo/python-list


Pandas Dataframe Numbers Comma Formatted

2020-05-09 Thread Joydeep C
I have a Pandas dataframe like below.

XY
0  1234567890
1  54321N/A
2  67890123456

I need to make these numbers comma formatted. For example, 12345 => 
12,345.

Please help.

Thanks.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Pandas Dataframe Numbers Comma Formatted

2020-05-09 Thread Joydeep C
On Sat, 09 May 2020 14:42:43 +0200, Python wrote:

> Joydeep wrote:
>> I have a Pandas dataframe like below.
>> 
>>  XY
>> 0  1234567890 1  54321N/A 2  67890123456
>> 
>> I need to make these numbers comma formatted. For example, 12345 =>
>> 12,345.
> 
>  >>> value = 12345 f'{value:,}'  # >= 3.6
> '12,345'
>  >>> '{:,}'.format(value)  # >= 2.7
> '12,345'

I need all the numbers in the whole dataframe to be formatted like that, 
not one value.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Pandas Dataframe Numbers Comma Formatted

2020-05-09 Thread Peter Otten
Joydeep C wrote:

> On Sat, 09 May 2020 14:42:43 +0200, Python wrote:
> 
>> Joydeep wrote:
>>> I have a Pandas dataframe like below.
>>> 
>>>  XY
>>> 0  1234567890 1  54321N/A 2  67890123456
>>> 
>>> I need to make these numbers comma formatted. For example, 12345 =>
>>> 12,345.
>> 
>>  >>> value = 12345 f'{value:,}'  # >= 3.6
>> '12,345'
>>  >>> '{:,}'.format(value)  # >= 2.7
>> '12,345'
> 
> I need all the numbers in the whole dataframe to be formatted like that,
> not one value.


>>> import pandas as pd
>>> df = pd.DataFrame([[12345., 67890.], [54321, "N/A"]], columns=["X","Y"])
>>> df
   X  Y
0  12345  67890
1  54321N/A

[2 rows x 2 columns]

Reading the docstring for you:

>>> help(df)

 |  
 |  to_string(self, buf=None, columns=None, col_space=None, colSpace=None, 
header=True, index=True, na_rep='NaN', formatters=None, float_format=None, 
sparsify=None, nanRep=None, index_names=True, justify=None, 
force_unicode=None, line_width=None, max_rows=None, max_cols=None, 
show_dimensions=False)
 |  Render a DataFrame to a console-friendly tabular output.
 |  
 |   Parameters
 |   --
 |   frame : DataFrame
 |   object to render
...
 |  float_format : one-parameter function, optional
 |  formatter function to apply to columns' elements if they are 
floats
 |  default None

So:

>>> print(df.to_string(float_format="{:,.0f}".format))
   X  Y
0 12,345 67,890
1 54,321N/A



-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Pandas Dataframe Numbers Comma Formatted

2020-05-09 Thread Joydeep C
On Sat, 09 May 2020 15:46:27 +0200, Python wrote:

> Joydeep C wrote:
>> On Sat, 09 May 2020 14:42:43 +0200, Python wrote:
>> 
>>> Joydeep wrote:
 I have a Pandas dataframe like below.

   XY
 0  1234567890 1  54321N/A 2  67890123456

 I need to make these numbers comma formatted. For example, 12345 =>
 12,345.
>>>
>>>   >>> value = 12345 f'{value:,}'  # >= 3.6
>>> '12,345'
>>>   >>> '{:,}'.format(value)  # >= 2.7
>>> '12,345'
>> 
>> I need all the numbers in the whole dataframe to be formatted like
>> that,
>> not one value.
> 
>  >>> data.applymap((lambda x: f"{x:,}") )
>  X Y
> 0  12,345  67,890.0 1  54,321   nan 2  67,890  12,345.0
>  >>> data.apply(np.vectorize((lambda x: f"{x:,}")))
>  X Y
> 0  12,345  67,890.0 1  54,321   nan 2  67,890  12,345.0

It's giving error - "Cannot specify ',' with 's'."
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Pandas Dataframe Numbers Comma Formatted

2020-05-09 Thread Joydeep C
On Sat, 09 May 2020 17:24:41 +0200, Python wrote:

> Joydeep C wrote:
>> On Sat, 09 May 2020 15:46:27 +0200, Python wrote:
>> 
>>> Joydeep C wrote:
 On Sat, 09 May 2020 14:42:43 +0200, Python wrote:

> Joydeep wrote:
>> I have a Pandas dataframe like below.
>>
>>XY
>> 0  1234567890 1  54321N/A 2  67890123456
>>
>> I need to make these numbers comma formatted. For example, 12345 =>
>> 12,345.
>
>>>> value = 12345 f'{value:,}'  # >= 3.6
> '12,345'
>>>> '{:,}'.format(value)  # >= 2.7
> '12,345'

 I need all the numbers in the whole dataframe to be formatted like
 that,
 not one value.
>>>
>>>   >>> data.applymap((lambda x: f"{x:,}") )
>>>   X Y
>>> 0  12,345  67,890.0 1  54,321   nan 2  67,890  12,345.0
>>>   >>> data.apply(np.vectorize((lambda x: f"{x:,}")))
>>>   X Y
>>> 0  12,345  67,890.0 1  54,321   nan 2  67,890  12,345.0
>> 
>> It's giving error - "Cannot specify ',' with 's'."
> 
> It means that you're not storing numbers in your dataframe but strings,
> which is likely not what you want here. Fix that first.

Of course, they are strings. It's "N/A", not nan.
-- 
https://mail.python.org/mailman/listinfo/python-list


Concatenation of multiple video files in single file

2020-05-09 Thread Akshay Ghodake
Hello,

I want a help to concatenation of multiple video files into a single file
in python.

Any help will be greatly appreciated.

Best regards,
Akshay Ghodake
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Pandas Dataframe Numbers Comma Formatted

2020-05-09 Thread Python

Joydeep C wrote:

On Sat, 09 May 2020 15:46:27 +0200, Python wrote:


Joydeep C wrote:

On Sat, 09 May 2020 14:42:43 +0200, Python wrote:


Joydeep wrote:

I have a Pandas dataframe like below.

   XY
0  1234567890 1  54321N/A 2  67890123456

I need to make these numbers comma formatted. For example, 12345 =>
12,345.


   >>> value = 12345 f'{value:,}'  # >= 3.6
'12,345'
   >>> '{:,}'.format(value)  # >= 2.7
'12,345'


I need all the numbers in the whole dataframe to be formatted like
that,
not one value.


  >>> data.applymap((lambda x: f"{x:,}") )
  X Y
0  12,345  67,890.0 1  54,321   nan 2  67,890  12,345.0
  >>> data.apply(np.vectorize((lambda x: f"{x:,}")))
  X Y
0  12,345  67,890.0 1  54,321   nan 2  67,890  12,345.0


It's giving error - "Cannot specify ',' with 's'."


It means that you're not storing numbers in your dataframe but
strings, which is likely not what you want here. Fix that
first.





--
https://mail.python.org/mailman/listinfo/python-list


Re: Pandas Dataframe Numbers Comma Formatted

2020-05-09 Thread Python

Joydeep wrote:

I have a Pandas dataframe like below.

 XY
0  1234567890
1  54321N/A
2  67890123456

I need to make these numbers comma formatted. For example, 12345 =>
12,345.


>>> value = 12345
>>> f'{value:,}'  # >= 3.6
'12,345'
>>> '{:,}'.format(value)  # >= 2.7
'12,345'
--
https://mail.python.org/mailman/listinfo/python-list


Re: Pandas Dataframe Numbers Comma Formatted

2020-05-09 Thread Python

Joydeep C wrote:

On Sat, 09 May 2020 17:24:41 +0200, Python wrote:


Joydeep C wrote:

On Sat, 09 May 2020 15:46:27 +0200, Python wrote:


Joydeep C wrote:

On Sat, 09 May 2020 14:42:43 +0200, Python wrote:


Joydeep wrote:

I have a Pandas dataframe like below.

XY
0  1234567890 1  54321N/A 2  67890123456

I need to make these numbers comma formatted. For example, 12345 =>
12,345.


>>> value = 12345 f'{value:,}'  # >= 3.6
'12,345'
>>> '{:,}'.format(value)  # >= 2.7
'12,345'


I need all the numbers in the whole dataframe to be formatted like
that,
not one value.


   >>> data.applymap((lambda x: f"{x:,}") )
   X Y
0  12,345  67,890.0 1  54,321   nan 2  67,890  12,345.0
   >>> data.apply(np.vectorize((lambda x: f"{x:,}")))
   X Y
0  12,345  67,890.0 1  54,321   nan 2  67,890  12,345.0


It's giving error - "Cannot specify ',' with 's'."


It means that you're not storing numbers in your dataframe but strings,
which is likely not what you want here. Fix that first.


Of course, they are strings. It's "N/A", not nan.


So convert back to float in the lambda, when appropriate, then use the
format string.



--
https://mail.python.org/mailman/listinfo/python-list


Re: Pandas Dataframe Numbers Comma Formatted

2020-05-09 Thread Python

Joydeep C wrote:

On Sat, 09 May 2020 14:42:43 +0200, Python wrote:


Joydeep wrote:

I have a Pandas dataframe like below.

  XY
0  1234567890 1  54321N/A 2  67890123456

I need to make these numbers comma formatted. For example, 12345 =>
12,345.


  >>> value = 12345 f'{value:,}'  # >= 3.6
'12,345'
  >>> '{:,}'.format(value)  # >= 2.7
'12,345'


I need all the numbers in the whole dataframe to be formatted like that,
not one value.


>>> data.applymap((lambda x: f"{x:,}") )
X Y
0  12,345  67,890.0
1  54,321   nan
2  67,890  12,345.0
>>> data.apply(np.vectorize((lambda x: f"{x:,}")))
X Y
0  12,345  67,890.0
1  54,321   nan
2  67,890  12,345.0

--
https://mail.python.org/mailman/listinfo/python-list


Re: Concatenation of multiple video files in single file

2020-05-09 Thread Chris Angelico
On Sun, May 10, 2020 at 8:50 AM Akshay Ghodake  wrote:
>
> Hello,
>
> I want a help to concatenation of multiple video files into a single file
> in python.
>
> Any help will be greatly appreciated.

Step 1:
import subprocess

Step 2:
Run ffmpeg

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: IP address to binary conversion

2020-05-09 Thread al . alexiev
Hi Alan,

Yes, agreed that any '!I' or '!L' combination will work on different type of 
platforms in a consistent manner, when applied in both directions.

I was referring to Alex Martelli's output, where the conversion back to IP 
seems to be reversed, even with '!L', which means that he's already with a 
little-endian byte order and using 'L' or '>> ip = '1.2.168.0'
>>> struct.unpack('L', socket.inet_aton(ip))[0]
11010561
>>> struct.unpack('>> struct.unpack('!L', socket.inet_aton(ip))[0]
16951296
>>>
>>> socket.inet_ntoa(struct.pack('!L',11010561))
'0.168.2.1'
>>> socket.inet_ntoa(struct.pack('>> socket.inet_ntoa(struct.pack('!L',16951296))
'1.2.168.0'
>>>


Greets,
Alex
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Should setuptools version propagate to a module's __version__? If so, how?

2020-05-09 Thread Cameron Simpson

On 08May2020 18:07, John Ladasky  wrote:

I just came across a package in PyPI which is in a state of neglect.  The 
official version on the PyPI page is 1.3.1 -- but the installed module reports 
its version as 1.2.0.  This is confusing.

There are several bugs in this package besides the mismatched version number.  
I've forked a copy of the package on GitHub, and I will attempt a cleanup.

In another private package of my own, I performed an unsavory hack in setup.py.  There is a 
"version" argument to the setup() call.  I define "version" as a global 
variable in setup.py.  Before I call setup with this version number, I also modify the line of 
package code which defines its __version__.  This works for me, but it feels wrong.

Is there a recommended way to keep the internal reference and the 
setup.py reference in sync?  Is there any reason someone would NOT want 
these numbers to match?


My release script writes the setup.py on the fly, so it gets the version 
number from the release tag I use. I also autopatch the module itself to 
set __version__ to match when I make that release tag.


Cheers,
Cameron Simpson 
--
https://mail.python.org/mailman/listinfo/python-list


Re: Concatenation of multiple video files in single file

2020-05-09 Thread Wildman via Python-list
On Sat, 09 May 2020 22:06:01 +0530, Akshay Ghodake wrote:

> Hello,
> 
> I want a help to concatenation of multiple video files into a single file
> in python.
> 
> Any help will be greatly appreciated.
> 
> Best regards,
> Akshay Ghodake

This might help...

https://kkroening.github.io/ffmpeg-python/

-- 
 GNU/Linux user #557453
The cow died so I don't need your bull!
-- 
https://mail.python.org/mailman/listinfo/python-list