You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by shyla deshpande <de...@gmail.com> on 2017/12/12 19:12:45 UTC

How do I save the dataframe data as a pdf file?

Hello all,

Is there a way to write the dataframe data as a pdf file?

Thanks
-Shyla

Re: How do I save the dataframe data as a pdf file?

Posted by Anthony Thomas <ah...@eng.ucsd.edu>.
No problem. Assuming you're data has been collected as "A =
Array[Array[Double]]" something along the lines of "A.map(x => x.mkString("
& ")).mkString(" \\\\ \n")" should do the trick. Another, somewhat more
convoluted, option would be to write your data as a CSV or other delimited
text file and then write a small Python/R wrapper which consumes those and
writes tex tables.

Anthony

On Tue, Dec 12, 2017 at 11:38 AM, anna stax <an...@gmail.com> wrote:

> Thanks Anthony for the response.
>
> Yes, the data in the dataframe represents a report and I want to create
> pdf files.
> I am using scala so hoping to find a easier solution in scala, if not I
> will try out your suggestion .
>
>
> On Tue, Dec 12, 2017 at 11:29 AM, Anthony Thomas <ah...@eng.ucsd.edu>
> wrote:
>
>> Are you trying to produce a formatted table in a pdf file where the
>> numbers in the table come from a dataframe? I.e. to present summary
>> statistics or other aggregates? If so I would guess your best bet would be
>> to collect the dataframe as a Pandas dataframe and use the to_latex method.
>> You can then use a standard latex compiler to produce a pdf with a table
>> containing that data. I don't know if there's any comparable built-in for
>> Scala, but you could always collect the data as an array of arrays and
>> write these to a tex file using standard IO. Maybe someone has an easier
>> suggestion.
>>
>> On Tue, Dec 12, 2017 at 11:12 AM, shyla deshpande <
>> deshpandeshyla@gmail.com> wrote:
>>
>>> Hello all,
>>>
>>> Is there a way to write the dataframe data as a pdf file?
>>>
>>> Thanks
>>> -Shyla
>>>
>>
>>
>

Re: How do I save the dataframe data as a pdf file?

Posted by anna stax <an...@gmail.com>.
Thanks Anthony for the response.

Yes, the data in the dataframe represents a report and I want to create pdf
files.
I am using scala so hoping to find a easier solution in scala, if not I
will try out your suggestion .


On Tue, Dec 12, 2017 at 11:29 AM, Anthony Thomas <ah...@eng.ucsd.edu>
wrote:

> Are you trying to produce a formatted table in a pdf file where the
> numbers in the table come from a dataframe? I.e. to present summary
> statistics or other aggregates? If so I would guess your best bet would be
> to collect the dataframe as a Pandas dataframe and use the to_latex method.
> You can then use a standard latex compiler to produce a pdf with a table
> containing that data. I don't know if there's any comparable built-in for
> Scala, but you could always collect the data as an array of arrays and
> write these to a tex file using standard IO. Maybe someone has an easier
> suggestion.
>
> On Tue, Dec 12, 2017 at 11:12 AM, shyla deshpande <
> deshpandeshyla@gmail.com> wrote:
>
>> Hello all,
>>
>> Is there a way to write the dataframe data as a pdf file?
>>
>> Thanks
>> -Shyla
>>
>
>

Re: How do I save the dataframe data as a pdf file?

Posted by Anthony Thomas <ah...@eng.ucsd.edu>.
Are you trying to produce a formatted table in a pdf file where the numbers
in the table come from a dataframe? I.e. to present summary statistics or
other aggregates? If so I would guess your best bet would be to collect the
dataframe as a Pandas dataframe and use the to_latex method. You can then
use a standard latex compiler to produce a pdf with a table containing that
data. I don't know if there's any comparable built-in for Scala, but you
could always collect the data as an array of arrays and write these to a
tex file using standard IO. Maybe someone has an easier suggestion.

On Tue, Dec 12, 2017 at 11:12 AM, shyla deshpande <de...@gmail.com>
wrote:

> Hello all,
>
> Is there a way to write the dataframe data as a pdf file?
>
> Thanks
> -Shyla
>