Re: print small DataFrame to STDOUT and read it back into dataframe
On 4/6/2020 11:05 PM, Luca wrote: On 4/6/2020 8:51 PM, Reto wrote: out = df.to_csv(None) new = pd.read_csv(io.StringIO(out), index_col=0) Thank you, brother. It works BTW, a little gotcha (I write this in case someone gets here in the future through Google or something) """ import pandas as pd import numpy as np import io df = pd.DataFrame(10*np.random.randn(3,4)) df = df.astype(int) out = df.to_csv(None) # out == ',0,1,2,3\n0,9,4,-5,-2\n1,16,12,-1,-5\n2,-2,8,0,6\n' new = pd.read_csv(io.StringIO(out), index_col=0) #gotcha type(df.iloc[1,1]) # numpy.int32 type(new.iloc[1,1]) # numpy.int64 """ new == out will return a dataframe of False 0 1 2 3 0 False False False False 1 False False False False 2 False False False False Thanks again -- https://mail.python.org/mailman/listinfo/python-list
kill a window
Hi,
I have a script that read a netcdf data. I enter with keiboard two
values for latitude initial an final and same for longitude and I plot a
map. I use the command plt.close(1) to kill the window. But, my window
is not closed. This is a small par o my script:
m = Basemap(llcrnrlon=loni, llcrnrlat=lati,
urcrnrlon=lonf, urcrnrlat=latf,
resolution='i', projection='merc',
lon_0=dellon, lat_0=dellat)
# can get the identical map this way (by specifying width and
# height instead of lat/lon corners)
# m = Basemap(width=894887,height=1116766,\
# resolution='i',projection='tmerc',lon_0=-4.36,lat_0=54.7)
m.drawcoastlines()
m.fillcontinents(color='coral', lake_color='aqua')
m.drawparallels(np.arange(lati, latf, 5.))
m.drawmeridians(np.arange(loni, lonf, 5.))
m.drawmapboundary(fill_color='aqua')
plt.title("Região a Ser Setorizada")
plt.show()
plt,close(1)
and to kil the window I have to click on the "X" in the top my window.
What can I do to kil the window and plot other windows in squence.
Thanks,
Conrado
--
https://mail.python.org/mailman/listinfo/python-list
Re: kill a window
Are you doing it in tkinter? If so then close will be quit.
Souvik flutter dev
On Wed, Apr 8, 2020, 1:22 AM J Conrado wrote:
>
>
> Hi,
>
> I have a script that read a netcdf data. I enter with keiboard two
> values for latitude initial an final and same for longitude and I plot a
> map. I use the command plt.close(1) to kill the window. But, my window
> is not closed. This is a small par o my script:
>
>
> m = Basemap(llcrnrlon=loni, llcrnrlat=lati,
> urcrnrlon=lonf, urcrnrlat=latf,
> resolution='i', projection='merc',
> lon_0=dellon, lat_0=dellat)
>
> # can get the identical map this way (by specifying width and
> # height instead of lat/lon corners)
> # m = Basemap(width=894887,height=1116766,\
> # resolution='i',projection='tmerc',lon_0=-4.36,lat_0=54.7)
> m.drawcoastlines()
> m.fillcontinents(color='coral', lake_color='aqua')
> m.drawparallels(np.arange(lati, latf, 5.))
> m.drawmeridians(np.arange(loni, lonf, 5.))
> m.drawmapboundary(fill_color='aqua')
> plt.title("Região a Ser Setorizada")
>
>
> plt.show()
>
> plt,close(1)
>
> and to kil the window I have to click on the "X" in the top my window.
>
> What can I do to kil the window and plot other windows in squence.
>
>
> Thanks,
>
>
> Conrado
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
--
https://mail.python.org/mailman/listinfo/python-list
Re: kill a window
On 8/04/20 4:37 AM, J Conrado wrote:
...
plt.title("Região a Ser Setorizada")
plt.show()
plt,close(1)
and to kil the window I have to click on the "X" in the top my window.
What can I do to kil the window and plot other windows in squence.
Ola, perhaps use dotted-notation:
plt.close( 1 )
^
|
--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list
Re: kill a window
On 4/7/2020 12:37 PM, J Conrado wrote: plt,close(1) You must have meant 'plt.close(1)', with a period. and to kil the window I have to click on the "X" in the top my window. What can I do to kil the window and plot other windows in squence. You code omits the definition of 'plt', so I won't try to say anything except to reread its docs. What does the argument '1' mean? A close function may or may not destroy the widget. -- Terry Jan Reedy -- https://mail.python.org/mailman/listinfo/python-list
Re: "min( arg1, arg2, *args )" vs. "print( value, ... )"?
On 6-4-2020 22:57, Stefan Ram wrote:
The documentation ("help" under CPython 3.9) for "min" reads
(simplified):
min( arg1, arg2, *args )
, for "print" it reads (simplified):
print( value, ... ).
The caller can place an arbitrary number of arguments at the
place of "value, ..." or of "*args", respectively.
So, from the point of view of the caller: is there any
difference between "args, ..." and "*args" when he reads
it in the documentation?
`arg1, arg2, *args` is just a smart way to say you need at least 2 args.
--
Luuk
--
https://mail.python.org/mailman/listinfo/python-list
