Open a Latex file with Pandas?
I am trying to replicate using Python the content of the "Tidy Data" paper available here.
However, the datasets are available on github as .tex files, and I can't seem to be able to open them with pandas.
To the extent of my searches so far, it seems that pandas can export to latex, but not import from it...
1) Am I correct ?
2) If so, how would you advise me to open those files ?
Thank you for your time !
python pandas latex
add a comment |
I am trying to replicate using Python the content of the "Tidy Data" paper available here.
However, the datasets are available on github as .tex files, and I can't seem to be able to open them with pandas.
To the extent of my searches so far, it seems that pandas can export to latex, but not import from it...
1) Am I correct ?
2) If so, how would you advise me to open those files ?
Thank you for your time !
python pandas latex
tex - files are simple text that contains all information for the latex processor to create f.e. a .ps or .pdf. github.com/hadley/tidy-data/blob/master/data/billboard-raw.tex is one of the datafiles, it holds the table data that can be parsed by latex. Do you want to know if there is a way to somehow extract the text from the tex-file and create some other kind of data (csv f.e.) ?
– Patrick Artner
Nov 28 '18 at 18:09
1) Pretty sure that you are correct. It is easy for pandas to write a .tex file, much more difficult to read from them as they may have different structures. 2) Transform your tex file to csv or json using some tool you like (bash, python, perl, ...), then read the transformed files using pandas
– Corentin Limier
Nov 28 '18 at 18:11
Thank for your answers ! Yes Patrick, that's what I want to do. In the end I want to start from the "messy" table and manipulate it to get to a tidy format. For this I need the table stored in a DataFrame somehow. So Corentin your comment is interesting : how do I transform my .tex into a csv file ?
– Benjamin Dubreu
Nov 28 '18 at 18:12
1
Maybe a tex-forum would be a better place to ask how to transform tex to .... see f.e. here with this answer
– Patrick Artner
Nov 28 '18 at 18:13
That's a good start, thanks !
– Benjamin Dubreu
Nov 28 '18 at 18:16
add a comment |
I am trying to replicate using Python the content of the "Tidy Data" paper available here.
However, the datasets are available on github as .tex files, and I can't seem to be able to open them with pandas.
To the extent of my searches so far, it seems that pandas can export to latex, but not import from it...
1) Am I correct ?
2) If so, how would you advise me to open those files ?
Thank you for your time !
python pandas latex
I am trying to replicate using Python the content of the "Tidy Data" paper available here.
However, the datasets are available on github as .tex files, and I can't seem to be able to open them with pandas.
To the extent of my searches so far, it seems that pandas can export to latex, but not import from it...
1) Am I correct ?
2) If so, how would you advise me to open those files ?
Thank you for your time !
python pandas latex
python pandas latex
asked Nov 28 '18 at 17:59
Benjamin DubreuBenjamin Dubreu
526
526
tex - files are simple text that contains all information for the latex processor to create f.e. a .ps or .pdf. github.com/hadley/tidy-data/blob/master/data/billboard-raw.tex is one of the datafiles, it holds the table data that can be parsed by latex. Do you want to know if there is a way to somehow extract the text from the tex-file and create some other kind of data (csv f.e.) ?
– Patrick Artner
Nov 28 '18 at 18:09
1) Pretty sure that you are correct. It is easy for pandas to write a .tex file, much more difficult to read from them as they may have different structures. 2) Transform your tex file to csv or json using some tool you like (bash, python, perl, ...), then read the transformed files using pandas
– Corentin Limier
Nov 28 '18 at 18:11
Thank for your answers ! Yes Patrick, that's what I want to do. In the end I want to start from the "messy" table and manipulate it to get to a tidy format. For this I need the table stored in a DataFrame somehow. So Corentin your comment is interesting : how do I transform my .tex into a csv file ?
– Benjamin Dubreu
Nov 28 '18 at 18:12
1
Maybe a tex-forum would be a better place to ask how to transform tex to .... see f.e. here with this answer
– Patrick Artner
Nov 28 '18 at 18:13
That's a good start, thanks !
– Benjamin Dubreu
Nov 28 '18 at 18:16
add a comment |
tex - files are simple text that contains all information for the latex processor to create f.e. a .ps or .pdf. github.com/hadley/tidy-data/blob/master/data/billboard-raw.tex is one of the datafiles, it holds the table data that can be parsed by latex. Do you want to know if there is a way to somehow extract the text from the tex-file and create some other kind of data (csv f.e.) ?
– Patrick Artner
Nov 28 '18 at 18:09
1) Pretty sure that you are correct. It is easy for pandas to write a .tex file, much more difficult to read from them as they may have different structures. 2) Transform your tex file to csv or json using some tool you like (bash, python, perl, ...), then read the transformed files using pandas
– Corentin Limier
Nov 28 '18 at 18:11
Thank for your answers ! Yes Patrick, that's what I want to do. In the end I want to start from the "messy" table and manipulate it to get to a tidy format. For this I need the table stored in a DataFrame somehow. So Corentin your comment is interesting : how do I transform my .tex into a csv file ?
– Benjamin Dubreu
Nov 28 '18 at 18:12
1
Maybe a tex-forum would be a better place to ask how to transform tex to .... see f.e. here with this answer
– Patrick Artner
Nov 28 '18 at 18:13
That's a good start, thanks !
– Benjamin Dubreu
Nov 28 '18 at 18:16
tex - files are simple text that contains all information for the latex processor to create f.e. a .ps or .pdf. github.com/hadley/tidy-data/blob/master/data/billboard-raw.tex is one of the datafiles, it holds the table data that can be parsed by latex. Do you want to know if there is a way to somehow extract the text from the tex-file and create some other kind of data (csv f.e.) ?
– Patrick Artner
Nov 28 '18 at 18:09
tex - files are simple text that contains all information for the latex processor to create f.e. a .ps or .pdf. github.com/hadley/tidy-data/blob/master/data/billboard-raw.tex is one of the datafiles, it holds the table data that can be parsed by latex. Do you want to know if there is a way to somehow extract the text from the tex-file and create some other kind of data (csv f.e.) ?
– Patrick Artner
Nov 28 '18 at 18:09
1) Pretty sure that you are correct. It is easy for pandas to write a .tex file, much more difficult to read from them as they may have different structures. 2) Transform your tex file to csv or json using some tool you like (bash, python, perl, ...), then read the transformed files using pandas
– Corentin Limier
Nov 28 '18 at 18:11
1) Pretty sure that you are correct. It is easy for pandas to write a .tex file, much more difficult to read from them as they may have different structures. 2) Transform your tex file to csv or json using some tool you like (bash, python, perl, ...), then read the transformed files using pandas
– Corentin Limier
Nov 28 '18 at 18:11
Thank for your answers ! Yes Patrick, that's what I want to do. In the end I want to start from the "messy" table and manipulate it to get to a tidy format. For this I need the table stored in a DataFrame somehow. So Corentin your comment is interesting : how do I transform my .tex into a csv file ?
– Benjamin Dubreu
Nov 28 '18 at 18:12
Thank for your answers ! Yes Patrick, that's what I want to do. In the end I want to start from the "messy" table and manipulate it to get to a tidy format. For this I need the table stored in a DataFrame somehow. So Corentin your comment is interesting : how do I transform my .tex into a csv file ?
– Benjamin Dubreu
Nov 28 '18 at 18:12
1
1
Maybe a tex-forum would be a better place to ask how to transform tex to .... see f.e. here with this answer
– Patrick Artner
Nov 28 '18 at 18:13
Maybe a tex-forum would be a better place to ask how to transform tex to .... see f.e. here with this answer
– Patrick Artner
Nov 28 '18 at 18:13
That's a good start, thanks !
– Benjamin Dubreu
Nov 28 '18 at 18:16
That's a good start, thanks !
– Benjamin Dubreu
Nov 28 '18 at 18:16
add a comment |
2 Answers
2
active
oldest
votes
Using this as example :
import pandas as pd
from pandas.compat import StringIO
with open('test.tex') as input_file:
text = ""
for line in input_file:
if '&' in line:
text += line.replace('\', '') + 'n'
data = StringIO(text)
df = pd.read_csv(data, sep="&")
data.close()
Returns :
year artist track time date.entered wk1 wk2 wk3
0 2000 2 Pac Baby Don't Cry 4:22 2000-02-26 87 82 72
1 2000 2Ge+her The Hardest Part Of ... 3:15 2000-09-02 91 87 92
2 2000 3 Doors Down Kryptonite 3:53 2000-04-08 81 70 68
3 2000 98verb|^|0 Give Me Just One Nig... 3:24 2000-08-19 51 39 34
4 2000 A*Teens Dancing Queen 3:44 2000-07-08 97 97 96
5 2000 Aaliyah I Don't Wanna 4:15 2000-01-29 84 62 51
6 2000 Aaliyah Try Again 4:03 2000-03-18 59 53 38
7 2000 Adams, Yolanda Open My Heart 5:30 2000-08-26 76 76 74
You can also write one script which transform the file :
with open('test.tex') as input_file:
with open('test.csv', 'w') as output_file:
for line in input_file:
if '&' in line:
output_file.write(line.replace('\', '') + 'n')
Then another script wich uses pandas
import pandas as pd
pd.read_csv('test.csv', sep="&")
Sounds good, I'll try it with the pew research center's data and see how it goes ! thanks a lot ! Edit : this works. I'll take a look at what StringIO does !
– Benjamin Dubreu
Nov 28 '18 at 18:22
@BenjaminDubreu pd.read_csv() reads from file. StringIO object simulates a file object so that read_csv works without writing data to disk.
– Corentin Limier
Nov 28 '18 at 18:31
@BenjaminDubreu But I prefer the second solution and separates the action of transforming your file once and for all then reading the well-formated files with pandas.
– Corentin Limier
Nov 28 '18 at 18:32
You are right, I'll probably do that. Thank you very much !
– Benjamin Dubreu
Dec 6 '18 at 8:46
add a comment |
1) To my knowledge you can open any standard type of file with python
2) You could try:
with open('test.tex', 'w') as text_file:
//Do something to text_file here
Hi, sure I could, but then the goal of opening it with pandas is to manipulate the data. With opening the file and reading it character to character, I'd need to parse it to recreate columns on something... then I think I'd be better of replicating the data myself into a xls file or something
– Benjamin Dubreu
Nov 28 '18 at 18:10
Ho ok I understand now, thank you for explaining it :)
– Émile Bernard
Nov 28 '18 at 18:12
Could this be of any help? plot.ly/pandas/LaTeX
– Émile Bernard
Nov 28 '18 at 18:13
perhaps, I'll take a look at it, thanks (please note : I am not the one who downvoted your answer, thank you for taking the time ;) )
– Benjamin Dubreu
Nov 28 '18 at 18:14
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53525461%2fopen-a-latex-file-with-pandas%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Using this as example :
import pandas as pd
from pandas.compat import StringIO
with open('test.tex') as input_file:
text = ""
for line in input_file:
if '&' in line:
text += line.replace('\', '') + 'n'
data = StringIO(text)
df = pd.read_csv(data, sep="&")
data.close()
Returns :
year artist track time date.entered wk1 wk2 wk3
0 2000 2 Pac Baby Don't Cry 4:22 2000-02-26 87 82 72
1 2000 2Ge+her The Hardest Part Of ... 3:15 2000-09-02 91 87 92
2 2000 3 Doors Down Kryptonite 3:53 2000-04-08 81 70 68
3 2000 98verb|^|0 Give Me Just One Nig... 3:24 2000-08-19 51 39 34
4 2000 A*Teens Dancing Queen 3:44 2000-07-08 97 97 96
5 2000 Aaliyah I Don't Wanna 4:15 2000-01-29 84 62 51
6 2000 Aaliyah Try Again 4:03 2000-03-18 59 53 38
7 2000 Adams, Yolanda Open My Heart 5:30 2000-08-26 76 76 74
You can also write one script which transform the file :
with open('test.tex') as input_file:
with open('test.csv', 'w') as output_file:
for line in input_file:
if '&' in line:
output_file.write(line.replace('\', '') + 'n')
Then another script wich uses pandas
import pandas as pd
pd.read_csv('test.csv', sep="&")
Sounds good, I'll try it with the pew research center's data and see how it goes ! thanks a lot ! Edit : this works. I'll take a look at what StringIO does !
– Benjamin Dubreu
Nov 28 '18 at 18:22
@BenjaminDubreu pd.read_csv() reads from file. StringIO object simulates a file object so that read_csv works without writing data to disk.
– Corentin Limier
Nov 28 '18 at 18:31
@BenjaminDubreu But I prefer the second solution and separates the action of transforming your file once and for all then reading the well-formated files with pandas.
– Corentin Limier
Nov 28 '18 at 18:32
You are right, I'll probably do that. Thank you very much !
– Benjamin Dubreu
Dec 6 '18 at 8:46
add a comment |
Using this as example :
import pandas as pd
from pandas.compat import StringIO
with open('test.tex') as input_file:
text = ""
for line in input_file:
if '&' in line:
text += line.replace('\', '') + 'n'
data = StringIO(text)
df = pd.read_csv(data, sep="&")
data.close()
Returns :
year artist track time date.entered wk1 wk2 wk3
0 2000 2 Pac Baby Don't Cry 4:22 2000-02-26 87 82 72
1 2000 2Ge+her The Hardest Part Of ... 3:15 2000-09-02 91 87 92
2 2000 3 Doors Down Kryptonite 3:53 2000-04-08 81 70 68
3 2000 98verb|^|0 Give Me Just One Nig... 3:24 2000-08-19 51 39 34
4 2000 A*Teens Dancing Queen 3:44 2000-07-08 97 97 96
5 2000 Aaliyah I Don't Wanna 4:15 2000-01-29 84 62 51
6 2000 Aaliyah Try Again 4:03 2000-03-18 59 53 38
7 2000 Adams, Yolanda Open My Heart 5:30 2000-08-26 76 76 74
You can also write one script which transform the file :
with open('test.tex') as input_file:
with open('test.csv', 'w') as output_file:
for line in input_file:
if '&' in line:
output_file.write(line.replace('\', '') + 'n')
Then another script wich uses pandas
import pandas as pd
pd.read_csv('test.csv', sep="&")
Sounds good, I'll try it with the pew research center's data and see how it goes ! thanks a lot ! Edit : this works. I'll take a look at what StringIO does !
– Benjamin Dubreu
Nov 28 '18 at 18:22
@BenjaminDubreu pd.read_csv() reads from file. StringIO object simulates a file object so that read_csv works without writing data to disk.
– Corentin Limier
Nov 28 '18 at 18:31
@BenjaminDubreu But I prefer the second solution and separates the action of transforming your file once and for all then reading the well-formated files with pandas.
– Corentin Limier
Nov 28 '18 at 18:32
You are right, I'll probably do that. Thank you very much !
– Benjamin Dubreu
Dec 6 '18 at 8:46
add a comment |
Using this as example :
import pandas as pd
from pandas.compat import StringIO
with open('test.tex') as input_file:
text = ""
for line in input_file:
if '&' in line:
text += line.replace('\', '') + 'n'
data = StringIO(text)
df = pd.read_csv(data, sep="&")
data.close()
Returns :
year artist track time date.entered wk1 wk2 wk3
0 2000 2 Pac Baby Don't Cry 4:22 2000-02-26 87 82 72
1 2000 2Ge+her The Hardest Part Of ... 3:15 2000-09-02 91 87 92
2 2000 3 Doors Down Kryptonite 3:53 2000-04-08 81 70 68
3 2000 98verb|^|0 Give Me Just One Nig... 3:24 2000-08-19 51 39 34
4 2000 A*Teens Dancing Queen 3:44 2000-07-08 97 97 96
5 2000 Aaliyah I Don't Wanna 4:15 2000-01-29 84 62 51
6 2000 Aaliyah Try Again 4:03 2000-03-18 59 53 38
7 2000 Adams, Yolanda Open My Heart 5:30 2000-08-26 76 76 74
You can also write one script which transform the file :
with open('test.tex') as input_file:
with open('test.csv', 'w') as output_file:
for line in input_file:
if '&' in line:
output_file.write(line.replace('\', '') + 'n')
Then another script wich uses pandas
import pandas as pd
pd.read_csv('test.csv', sep="&")
Using this as example :
import pandas as pd
from pandas.compat import StringIO
with open('test.tex') as input_file:
text = ""
for line in input_file:
if '&' in line:
text += line.replace('\', '') + 'n'
data = StringIO(text)
df = pd.read_csv(data, sep="&")
data.close()
Returns :
year artist track time date.entered wk1 wk2 wk3
0 2000 2 Pac Baby Don't Cry 4:22 2000-02-26 87 82 72
1 2000 2Ge+her The Hardest Part Of ... 3:15 2000-09-02 91 87 92
2 2000 3 Doors Down Kryptonite 3:53 2000-04-08 81 70 68
3 2000 98verb|^|0 Give Me Just One Nig... 3:24 2000-08-19 51 39 34
4 2000 A*Teens Dancing Queen 3:44 2000-07-08 97 97 96
5 2000 Aaliyah I Don't Wanna 4:15 2000-01-29 84 62 51
6 2000 Aaliyah Try Again 4:03 2000-03-18 59 53 38
7 2000 Adams, Yolanda Open My Heart 5:30 2000-08-26 76 76 74
You can also write one script which transform the file :
with open('test.tex') as input_file:
with open('test.csv', 'w') as output_file:
for line in input_file:
if '&' in line:
output_file.write(line.replace('\', '') + 'n')
Then another script wich uses pandas
import pandas as pd
pd.read_csv('test.csv', sep="&")
edited Nov 28 '18 at 18:45
answered Nov 28 '18 at 18:19
Corentin LimierCorentin Limier
2,0511611
2,0511611
Sounds good, I'll try it with the pew research center's data and see how it goes ! thanks a lot ! Edit : this works. I'll take a look at what StringIO does !
– Benjamin Dubreu
Nov 28 '18 at 18:22
@BenjaminDubreu pd.read_csv() reads from file. StringIO object simulates a file object so that read_csv works without writing data to disk.
– Corentin Limier
Nov 28 '18 at 18:31
@BenjaminDubreu But I prefer the second solution and separates the action of transforming your file once and for all then reading the well-formated files with pandas.
– Corentin Limier
Nov 28 '18 at 18:32
You are right, I'll probably do that. Thank you very much !
– Benjamin Dubreu
Dec 6 '18 at 8:46
add a comment |
Sounds good, I'll try it with the pew research center's data and see how it goes ! thanks a lot ! Edit : this works. I'll take a look at what StringIO does !
– Benjamin Dubreu
Nov 28 '18 at 18:22
@BenjaminDubreu pd.read_csv() reads from file. StringIO object simulates a file object so that read_csv works without writing data to disk.
– Corentin Limier
Nov 28 '18 at 18:31
@BenjaminDubreu But I prefer the second solution and separates the action of transforming your file once and for all then reading the well-formated files with pandas.
– Corentin Limier
Nov 28 '18 at 18:32
You are right, I'll probably do that. Thank you very much !
– Benjamin Dubreu
Dec 6 '18 at 8:46
Sounds good, I'll try it with the pew research center's data and see how it goes ! thanks a lot ! Edit : this works. I'll take a look at what StringIO does !
– Benjamin Dubreu
Nov 28 '18 at 18:22
Sounds good, I'll try it with the pew research center's data and see how it goes ! thanks a lot ! Edit : this works. I'll take a look at what StringIO does !
– Benjamin Dubreu
Nov 28 '18 at 18:22
@BenjaminDubreu pd.read_csv() reads from file. StringIO object simulates a file object so that read_csv works without writing data to disk.
– Corentin Limier
Nov 28 '18 at 18:31
@BenjaminDubreu pd.read_csv() reads from file. StringIO object simulates a file object so that read_csv works without writing data to disk.
– Corentin Limier
Nov 28 '18 at 18:31
@BenjaminDubreu But I prefer the second solution and separates the action of transforming your file once and for all then reading the well-formated files with pandas.
– Corentin Limier
Nov 28 '18 at 18:32
@BenjaminDubreu But I prefer the second solution and separates the action of transforming your file once and for all then reading the well-formated files with pandas.
– Corentin Limier
Nov 28 '18 at 18:32
You are right, I'll probably do that. Thank you very much !
– Benjamin Dubreu
Dec 6 '18 at 8:46
You are right, I'll probably do that. Thank you very much !
– Benjamin Dubreu
Dec 6 '18 at 8:46
add a comment |
1) To my knowledge you can open any standard type of file with python
2) You could try:
with open('test.tex', 'w') as text_file:
//Do something to text_file here
Hi, sure I could, but then the goal of opening it with pandas is to manipulate the data. With opening the file and reading it character to character, I'd need to parse it to recreate columns on something... then I think I'd be better of replicating the data myself into a xls file or something
– Benjamin Dubreu
Nov 28 '18 at 18:10
Ho ok I understand now, thank you for explaining it :)
– Émile Bernard
Nov 28 '18 at 18:12
Could this be of any help? plot.ly/pandas/LaTeX
– Émile Bernard
Nov 28 '18 at 18:13
perhaps, I'll take a look at it, thanks (please note : I am not the one who downvoted your answer, thank you for taking the time ;) )
– Benjamin Dubreu
Nov 28 '18 at 18:14
add a comment |
1) To my knowledge you can open any standard type of file with python
2) You could try:
with open('test.tex', 'w') as text_file:
//Do something to text_file here
Hi, sure I could, but then the goal of opening it with pandas is to manipulate the data. With opening the file and reading it character to character, I'd need to parse it to recreate columns on something... then I think I'd be better of replicating the data myself into a xls file or something
– Benjamin Dubreu
Nov 28 '18 at 18:10
Ho ok I understand now, thank you for explaining it :)
– Émile Bernard
Nov 28 '18 at 18:12
Could this be of any help? plot.ly/pandas/LaTeX
– Émile Bernard
Nov 28 '18 at 18:13
perhaps, I'll take a look at it, thanks (please note : I am not the one who downvoted your answer, thank you for taking the time ;) )
– Benjamin Dubreu
Nov 28 '18 at 18:14
add a comment |
1) To my knowledge you can open any standard type of file with python
2) You could try:
with open('test.tex', 'w') as text_file:
//Do something to text_file here
1) To my knowledge you can open any standard type of file with python
2) You could try:
with open('test.tex', 'w') as text_file:
//Do something to text_file here
answered Nov 28 '18 at 18:07
Émile BernardÉmile Bernard
317
317
Hi, sure I could, but then the goal of opening it with pandas is to manipulate the data. With opening the file and reading it character to character, I'd need to parse it to recreate columns on something... then I think I'd be better of replicating the data myself into a xls file or something
– Benjamin Dubreu
Nov 28 '18 at 18:10
Ho ok I understand now, thank you for explaining it :)
– Émile Bernard
Nov 28 '18 at 18:12
Could this be of any help? plot.ly/pandas/LaTeX
– Émile Bernard
Nov 28 '18 at 18:13
perhaps, I'll take a look at it, thanks (please note : I am not the one who downvoted your answer, thank you for taking the time ;) )
– Benjamin Dubreu
Nov 28 '18 at 18:14
add a comment |
Hi, sure I could, but then the goal of opening it with pandas is to manipulate the data. With opening the file and reading it character to character, I'd need to parse it to recreate columns on something... then I think I'd be better of replicating the data myself into a xls file or something
– Benjamin Dubreu
Nov 28 '18 at 18:10
Ho ok I understand now, thank you for explaining it :)
– Émile Bernard
Nov 28 '18 at 18:12
Could this be of any help? plot.ly/pandas/LaTeX
– Émile Bernard
Nov 28 '18 at 18:13
perhaps, I'll take a look at it, thanks (please note : I am not the one who downvoted your answer, thank you for taking the time ;) )
– Benjamin Dubreu
Nov 28 '18 at 18:14
Hi, sure I could, but then the goal of opening it with pandas is to manipulate the data. With opening the file and reading it character to character, I'd need to parse it to recreate columns on something... then I think I'd be better of replicating the data myself into a xls file or something
– Benjamin Dubreu
Nov 28 '18 at 18:10
Hi, sure I could, but then the goal of opening it with pandas is to manipulate the data. With opening the file and reading it character to character, I'd need to parse it to recreate columns on something... then I think I'd be better of replicating the data myself into a xls file or something
– Benjamin Dubreu
Nov 28 '18 at 18:10
Ho ok I understand now, thank you for explaining it :)
– Émile Bernard
Nov 28 '18 at 18:12
Ho ok I understand now, thank you for explaining it :)
– Émile Bernard
Nov 28 '18 at 18:12
Could this be of any help? plot.ly/pandas/LaTeX
– Émile Bernard
Nov 28 '18 at 18:13
Could this be of any help? plot.ly/pandas/LaTeX
– Émile Bernard
Nov 28 '18 at 18:13
perhaps, I'll take a look at it, thanks (please note : I am not the one who downvoted your answer, thank you for taking the time ;) )
– Benjamin Dubreu
Nov 28 '18 at 18:14
perhaps, I'll take a look at it, thanks (please note : I am not the one who downvoted your answer, thank you for taking the time ;) )
– Benjamin Dubreu
Nov 28 '18 at 18:14
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53525461%2fopen-a-latex-file-with-pandas%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
tex - files are simple text that contains all information for the latex processor to create f.e. a .ps or .pdf. github.com/hadley/tidy-data/blob/master/data/billboard-raw.tex is one of the datafiles, it holds the table data that can be parsed by latex. Do you want to know if there is a way to somehow extract the text from the tex-file and create some other kind of data (csv f.e.) ?
– Patrick Artner
Nov 28 '18 at 18:09
1) Pretty sure that you are correct. It is easy for pandas to write a .tex file, much more difficult to read from them as they may have different structures. 2) Transform your tex file to csv or json using some tool you like (bash, python, perl, ...), then read the transformed files using pandas
– Corentin Limier
Nov 28 '18 at 18:11
Thank for your answers ! Yes Patrick, that's what I want to do. In the end I want to start from the "messy" table and manipulate it to get to a tidy format. For this I need the table stored in a DataFrame somehow. So Corentin your comment is interesting : how do I transform my .tex into a csv file ?
– Benjamin Dubreu
Nov 28 '18 at 18:12
1
Maybe a tex-forum would be a better place to ask how to transform tex to .... see f.e. here with this answer
– Patrick Artner
Nov 28 '18 at 18:13
That's a good start, thanks !
– Benjamin Dubreu
Nov 28 '18 at 18:16