Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC: add doc for reading from DataFrame.to_html #3656

Merged
merged 2 commits into from
May 21, 2013
Merged

DOC: add doc for reading from DataFrame.to_html #3656

merged 2 commits into from
May 21, 2013

Conversation

cpcloud
Copy link
Member

@cpcloud cpcloud commented May 20, 2013

No description provided.

@jreback
Copy link
Contributor

jreback commented May 21, 2013

ok to merge?

@cpcloud
Copy link
Member Author

cpcloud commented May 21, 2013

just added more notes, so yep

@jreback
Copy link
Contributor

jreback commented May 21, 2013

dont' use assert_frame_equal in the v0.11.1...instead print out the table
I would not use df_list, maybe alist or something (you note that the return type is a list is good and would leave that in though)
e.g. alist[0] (or alist[0].head()) if its too long

@jreback
Copy link
Contributor

jreback commented May 21, 2013

perfect!

fyi....since its ipython, the print is not necessary....

@cpcloud
Copy link
Member Author

cpcloud commented May 21, 2013

cool. i figured. pre-ipdb debugging habits die hard!

@jreback
Copy link
Contributor

jreback commented May 21, 2013

hmm....can you rebase on top of master?

@cpcloud
Copy link
Member Author

cpcloud commented May 21, 2013

Yeah sorry. Will do when I get to a machine...

@cpcloud
Copy link
Member Author

cpcloud commented May 21, 2013

@jreback rebased.

@jreback
Copy link
Contributor

jreback commented May 21, 2013

something failed......

https://www.travis-ci.org/cpcloud/pandas/jobs/7363117

@cpcloud
Copy link
Member Author

cpcloud commented May 21, 2013

yep saw it i'm on it, i'm getting a different error locally about recursion depth...

@cpcloud
Copy link
Member Author

cpcloud commented May 21, 2013

prolly cause i changed the default of infer types...and thus everything is evil object arrays

@cpcloud
Copy link
Member Author

cpcloud commented May 21, 2013

@jreback any changes to assert_frame_equal recently? not made by me...

@cpcloud
Copy link
Member Author

cpcloud commented May 21, 2013

ugh why does assert a == b, "%s != %s" % (a, b) not cause a recursion error but assert a == b, "{0} != {1}".format(a, b) does?!

@jreback
Copy link
Contributor

jreback commented May 21, 2013

I think @y-p changed something...didn't seem to affect me

(btw you can NOT have it compare dtypes, there is an option)

but I think you should have infer_dtypes=True by default, it makes sense
(or at least maybe do floats/ints by default), even dates really
people can always turn it off

@cpcloud
Copy link
Member Author

cpcloud commented May 21, 2013

ok...the example of reading in the output of df.to_html() will fail because DataFrame(['a']).convert_objects(convert_dates='coerce') thinks 'a' is a date. i will just use soft conversion then

@jreback
Copy link
Contributor

jreback commented May 21, 2013

yeh...dates are tough (though coerce will only convert if at least 1 item is a date)......(if all are not dates then it will leave it)

@cpcloud
Copy link
Member Author

cpcloud commented May 21, 2013

wait but why is 'a' considered a date?

@jreback
Copy link
Contributor

jreback commented May 21, 2013

what is in the series? a (alone) shouldn't trigger it

@cpcloud
Copy link
Member Author

cpcloud commented May 21, 2013

if u just do

s = Series(['a']).convert_objects(convert_dates='coerce')

s now has a date. I think this is a bug...

note new date conversion behavior

jreback doc recommendations

cannot pass a string to to_thml

gah

working notes

modify tests

infer_types back to true as per disc. with @jreback

fix failing tests because of not correctly converted dates

weird recursion error when using format spec instead of format strings
@jreback
Copy link
Contributor

jreback commented May 21, 2013

evil! I can see 'today' being parsed to today, but a????

(Pdb) import dateutil
(Pdb) dateutil.parser.parse('a')
datetime.datetime(2013, 5, 21, 0, 0)

@cpcloud
Copy link
Member Author

cpcloud commented May 21, 2013

@jreback travis is now all green

@cpcloud
Copy link
Member Author

cpcloud commented May 21, 2013

ah yes when parsers become too powerful and take over the world! mwahaha!

@cpcloud
Copy link
Member Author

cpcloud commented May 21, 2013

it's because 'a' is a token for 'am'

@cpcloud
Copy link
Member Author

cpcloud commented May 21, 2013

and also the default of just returning the current time kicks in since the parse of 'a' returns None.

@cpcloud
Copy link
Member Author

cpcloud commented May 21, 2013

kind of insane if u ask me...

@jreback
Copy link
Contributor

jreback commented May 21, 2013

a,m,p,t are the offenders (I check them all now).....so odd, you would think you could turn this option off

@jreback
Copy link
Contributor

jreback commented May 21, 2013

see #3671

@jreback
Copy link
Contributor

jreback commented May 21, 2013

ok...merging.....after my PR you can decide if you want to turn convert_dates back on (or even make it a separate option to read_html)

jreback added a commit that referenced this pull request May 21, 2013
DOC: add doc for reading from DataFrame.to_html
@jreback jreback merged commit 9985ace into pandas-dev:master May 21, 2013
@cpcloud cpcloud deleted the read-html-to-html-doc branch May 22, 2013 02:07
@jreback
Copy link
Contributor

jreback commented May 25, 2013

@cpcloud if u have a chance
can u do a pr for read/write html in main docs (your read examples in v0.11.1 are prob good start)
at some point want to go thru the options that u allow a bit more in a doc example

and I don't think any docs for to_html

thxs

@cpcloud
Copy link
Member Author

cpcloud commented May 27, 2013

@jreback btw should the to_* collection of methods allow str in the buf argument (a file name)? i'm surprised that no one has raised this yet...

@cpcloud
Copy link
Member Author

cpcloud commented May 27, 2013

maybe someone has and there's a reason for not supporting it...i haven't looked through issues for it

@jreback
Copy link
Contributor

jreback commented May 27, 2013

as far as I know these methods should accept path_or_buf
may not be consistent

@cpcloud
Copy link
Member Author

cpcloud commented May 27, 2013

ok i will open a pr for any inconsistencies i find with that

@cpcloud
Copy link
Member Author

cpcloud commented May 28, 2013

@jreback would u mind if i show the html output as rendered html in the examples? that way a user gets the final result and doesn't have to open up browser to see the rendered html...

@jreback
Copy link
Contributor

jreback commented May 28, 2013

that would be nice

@cpcloud
Copy link
Member Author

cpcloud commented May 28, 2013

hm how do u feel about a bunch of html files in a subdirectory of source? don't think there's any thing like a context manager for sphinx

@jreback
Copy link
Contributor

jreback commented May 28, 2013

I think you can put what you need in doc/source/_static; this is how the .png get read in the plotting docs

@jreback
Copy link
Contributor

jreback commented May 28, 2013

as an example, I do this is io.rst (for showing how to read a legacy file)

    .. ipython:: python
        :suppress:

        import os
        legacy_file_path = os.path.abspath('source/_static/legacy_0.10.h5')

     .. ipython:: python

        # a legacy store
        legacy_store = HDFStore(legacy_file_path,'r')
        legacy_store

        # copy (and return the new handle)
            new_store = legacy_store.copy('store_new.h5')
            new_store
        new_store.close()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants