Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

TypeError: loadtxt() got an unexpected keyword argument 'max_rows'

1,270 views
Skip to first unread message

alberto

unread,
Sep 3, 2019, 12:02:26 PM9/3/19
to
Hi,
I produce a script to elaborate data

but command line $ python3.4 PlotnhvsvdBTP1.py

I have this error

Traceback (most recent call last):
File "PlotnhvsvdBTP1.py", line 31, in <module>
UCvol = np.loadtxt(outputtransfile,skiprows=26,max_rows=1,usecols=[1])
TypeError: loadtxt() got an unexpected keyword argument 'max_rows'

How could fix it?

I attacched my files

https://drive.google.com/file/d/1PgOcuEMFsaAuKTsbU0i0gwg04mDCJJoK/view?usp=sharing
https://drive.google.com/file/d/13E7vcGQtrOS1lw9RupGThGQ2vSGRfTFG/view?usp=sharing
https://drive.google.com/file/d/1Z6GKYtHthAyPO3wFHUFK10QweRpclu29/view?usp=sharing

regard

Alberto

Joel Goldstick

unread,
Sep 3, 2019, 12:25:23 PM9/3/19
to
Please don't attach files. Cut and paste code as text into email body
along with copy and pasted traceback.

That said I found this: .. versionadded:: 1.14.0
max_rows : int, optional

Check your version of loadtxt()?
> --
> https://mail.python.org/mailman/listinfo/python-list



--
Joel Goldstick
http://joelgoldstick.com/blog
http://cc-baseballstats.info/stats/birthdays

Rhodri James

unread,
Sep 3, 2019, 12:26:39 PM9/3/19
to
On 03/09/2019 17:02, alberto wrote:
> I have this error
>
> Traceback (most recent call last):
> File "PlotnhvsvdBTP1.py", line 31, in <module>
> UCvol = np.loadtxt(outputtransfile,skiprows=26,max_rows=1,usecols=[1])
> TypeError: loadtxt() got an unexpected keyword argument 'max_rows'
>
> How could fix it?

A quick google search suggests that you aren't using a recent enough
version of numpy. The "max_rows" keyword argument was added to
loadtxt() in version 1.16.0; you must be using an older version than
that. Your options are to upgrade the version of numpy you have (don't
ask me how, I've never used it) or delete the "max_rows=1" and accept
the inefficiency.

--
Rhodri James *-* Kynesim Ltd

Terry Reedy

unread,
Sep 3, 2019, 12:29:59 PM9/3/19
to
On 9/3/2019 12:02 PM, alberto wrote:
> Hi,
> I produce a script to elaborate data
>
> but command line $ python3.4 PlotnhvsvdBTP1.py
>
> I have this error
>
> Traceback (most recent call last):
> File "PlotnhvsvdBTP1.py", line 31, in <module>
> UCvol = np.loadtxt(outputtransfile,skiprows=26,max_rows=1,usecols=[1])
> TypeError: loadtxt() got an unexpected keyword argument 'max_rows'
>
> How could fix it?

Don't do what the message says is the wrong thing to do. Really.

In particular, don't pass 'max_rows=1'. To find out what *to* do, read
the doc for the loadtxt function. From 'skiprows' and 'usecols', with
no underscore, I suspect you should pass 'maxrows=1'.

--
Terry Jan Reedy

MRAB

unread,
Sep 3, 2019, 12:38:20 PM9/3/19
to
The "max_rows" keyword argument is new in numpy version 1.16.0.

Which version do you have?

Try:

import numpy
print(numpy.__version__)
to find out.

MRAB

unread,
Sep 3, 2019, 1:12:11 PM9/3/19
to
On 2019-09-03 17:29, Terry Reedy wrote:
> On 9/3/2019 12:02 PM, alberto wrote:
>> Hi,
>> I produce a script to elaborate data
>>
>> but command line $ python3.4 PlotnhvsvdBTP1.py
>>
>> I have this error
>>
>> Traceback (most recent call last):
>> File "PlotnhvsvdBTP1.py", line 31, in <module>
>> UCvol = np.loadtxt(outputtransfile,skiprows=26,max_rows=1,usecols=[1])
>> TypeError: loadtxt() got an unexpected keyword argument 'max_rows'
>>
>> How could fix it?
>
> Don't do what the message says is the wrong thing to do. Really.
>
> In particular, don't pass 'max_rows=1'. To find out what *to* do, read
> the doc for the loadtxt function. From 'skiprows' and 'usecols', with
> no underscore, I suspect you should pass 'maxrows=1'.
>
No, the documentation says "max_rows".

Apparently, consistency, like the argument, is optional. :-)
0 new messages