-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: read_table error with tabs, dtype and index_col #4363
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
Comments
Could you add a csv/tsv file to that file that demonstrates it? I know On Thu, Jul 25, 2013 at 12:06 PM, Brent Pedersen - Bioinformatics <
|
I added the data file to the gist. https://gist.github.com/brentp/6066942/raw/95742c7811f89e032194e1f32a849272e0268c15/t.txt |
I was playing around with this. Weirdly, if you pass the text directly to the reader in text = StringIO(txt.replace(" ", "\t"))
df = pd.read_csv(text, dtype=np.int_, sep="\t", index_col=0)
print r"OK \t" Additionally, if you remove the dtype, it also works: df = pd.read_csv('t.txt', sep="\t")
print r"OK \t+", df.shape |
Okay, issue is the index column, everything works if you change index to integers. |
dupe of #9435 |
This gist demonstrates the problem:
https://gist.github.com/brentp/6066942
It's discussed in this thread:
https://groups.google.com/forum/#!topic/pydata/hIIZpZqbY5M
As discussed in the thread, there is some interaction when specifying dtype, index_col, and sep in read_csv.
As the gist shows, things work find with sep="\s+", but fail for the same set with sep="\t" even though the file is tab-delimited.
The text was updated successfully, but these errors were encountered: