0
$\begingroup$

I am trying to convert a TESS file into a csv file, using the to_csv function within the lightkurve package. I have tried:

import pandas as pd
from lightkurve import TessLightCurveFile
import lightkurve as lk
lc=TessLightCurveFile(r"C:\Users\me\documents\myTESSfitsfile")
lc 
pd.DataFrame.to_csv('lc'); 

which returns

AttributeError                           
 Traceback (most recent call last)
<ipython-input-12-64856d3ed63a> in <module>
      5 lc=TessLightCurveFile(r"C:\Users\me\documents\myTESSfitsfile")
      6 lc
----> 7 pd.DataFrame.to_csv('lc');

~\anaconda3\lib\site-packages\pandas\core\generic.py in to_csv(self, path_or_buf, sep, na_rep, float_format, columns, header, index, index_label, mode, encoding, compression, quoting, quotechar, line_terminator, chunksize, date_format, doublequote, escapechar, decimal)
   3176         """
   3177 
-> 3178         df = self if isinstance(self, ABCDataFrame) else self.to_frame()
   3179 
   3180         from pandas.io.formats.csvs import CSVFormatter

AttributeError: 'str' object has no attribute 'to_frame'

I have also tried:

lk.lightcurve.TessLightCurve.to_csv('lc');''' 

after I have flattened, folded, bls etc the light curve which also returns the same error. I know that 'to_frame' is what is missing from my 'str' and that this is probably really basic and 100% user error/me doing something stupid but I cannot figure out how to fix it.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.