OSDir


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

perplexing error


On 8 Sep 2018 17:25:52 GMT, Stefan Ram <ram at zedat.fu-berlin.de> wrote:
> Sharan Basappa <sharan.basappa at gmail.com> writes:
>>     66         # get the label for each log
>>     67         data_df['label'] = (data_df['label'] != '-').astype(int)
>>---> 68         #logger.debug("data frame %s \n", data_df)
>>     69         logger.debug("\n")
>>     70         raw_data = data_df[['label','seconds_since']].as_matrix()
>>AttributeError: 'str' object has no attribute 'raw_data' 
>>If you notice, line 68 is commented.
>>I am not sure what I am doing wrong.
>
>   In such cases, I do:
>
> print( 'at position 1' )
> data_df['label'] = (data_df['label'] != '-').astype(int)
> print( 'at position 2' )
> raw_data = data_df[['label','seconds_since']].as_matrix()
> print( 'at position 3' )
>
>   . If the last text printed is "at position 1", I will then
>   split even more:
>
> print( 'at position 1' )
> tmp = (data_df['label'] != '-').astype(int)
> print( 'at position 1a' )
> data_df['label'] = tmp
> print( 'at position 2' )
> raw_data = data_df[['label','seconds_since']].as_matrix()
> print( 'at position 3' )
>
>   and so on until the cause is reduced to the smallest
>   possible unit of code.

This approach is especially valuable when it turns out that
the file you're editing is not the file being included.

-- 
To email me, substitute nowhere->runbox, invalid->com.