|
Server : Apache System : Linux server112.speedpacket.com 3.10.0-962.3.2.lve1.5.36.el7.x86_64 #1 SMP Mon May 18 02:16:06 EDT 2020 x86_64 User : equistyl ( 1341) PHP Version : 8.1.30 Disable Function : NONE Directory : /lib64/python2.7/site-packages/mpl_toolkits/ |
Upload File : |
�
��<Pc @ sv d Z d d l Z d d l Z d d l Z d d l j Z d d l j Z d � Z
i e
_ d d d d d d � Z
d S( s�
Some io tools for excel -- requires xlwt
Example usage:
import matplotlib.mlab as mlab
import mpl_toolkits.exceltools as exceltools
r = mlab.csv2rec('somefile.csv', checkrows=0)
formatd = dict(
weight = mlab.FormatFloat(2),
change = mlab.FormatPercent(2),
cost = mlab.FormatThousands(2),
)
exceltools.rec2excel(r, 'test.xls', formatd=formatd)
mlab.rec2csv(r, 'test.csv', formatd=formatd)
i����Nc C s- t | � } t j j | � } | d k r. | St j | � } t j � } t | t
j � r� d j d g | j
� } d | | f | _ d | _ n� t | t
j � r� | j
d k r� d j d g | j
� } d | | f | _ qd | _ n$ t | t
j � r
d | _ n d } | | _ | t j | <| S( sn
copy the format, perform any overrides, and attach an xlstyle instance
copied format is returned
t t 0s 0.%s%%;[RED]-0.%s%%g �?i s #,##0.%s;[RED]-#,##0.%ss #,##;[RED]-#,##N( t hasht xlformat_factoryt created_formatst gett Nonet copyt deepcopyt excelt XFStylet
isinstancet mlabt
FormatPercentt joint precisiont num_format_strt scalet FormatFloatt FormatIntt xlstyle( t formatt keyt fmt_R t zeros( ( s= /usr/lib64/python2.7/site-packages/mpl_toolkits/exceltools.pyR s*
i t NaNt Infc C sz t } t j | � r? | } t j � } | j d � } t } n | d k rW t � } n g }
t j � } t | _
t j � } | | _ x� t
| j j � D]� \ }
} | j | } | j | � } | d k r� t j j | j t j � � } n t | � } | j | | |
| | � |
j | � q� W| d 7} t j t | j j � � } x| D]
} x� | D]� }
| |
} |
|
} | j | � } t j | � r�| j | | |
| � q_t j | � rt j | � } | d k r�| } n
d | } | j | | |
| � q_| j d k r1| j | | |
| � q_| j | | |
| | j � q_W| d 7} qRW| rv| j | � n | S( sv
save record array r to excel xlwt worksheet ws
starting at rownum. if ws is string like, assume it is a
filename and save to it
start writing at rownum, colnum
formatd is a dictionary mapping dtype name -> mlab.Format instances
nanstr is the string that mpl will put into excel for np.nan value
The next rownum after writing is returned
t worksheeti i s -%sN(! t Falset cbookt is_string_likeR t Workbookt add_sheett TrueR t dictt Fontt boldR
t fontt enumeratet dtypet namesR R t defaultformatdt typet FormatObjR t writet appendt npt aranget lent tovalt
safe_isnant
safe_isinft signR t save( t rt wst formatdt rownumt colnumt nanstrt infstrt autosavet filenamet wbt formatsR% t stylehdrt it namet dtR t indt rowt valt sgnt s( ( s= /usr/lib64/python2.7/site-packages/mpl_toolkits/exceltools.pyt rec2excelG sV
!
!( t __doc__R t numpyR. t xlwtR t matplotlib.cbookR t matplotlib.mlabR R R R RJ ( ( ( s= /usr/lib64/python2.7/site-packages/mpl_toolkits/exceltools.pyt <module> s &