Hide the \ mark of the display result

Hi,

Use python

I want to acquire a row in a row like an excel sheet,

but when I look at the acquisition result,

it is displayed as "¥" and it is displayed in the lower row.

Please help Is there a solution?

Here is the code and the output result.

image

    instruments=[
'1801.T',
],
fields = [
'TR.Cash',
'TR.CashAndEquivalents',
'TR.ShortTermInvestments',
'TR.CashAndSTInvestments',
'TR.AcctsReceivTradeGross',
'TR.ProvsnForDoubtfulAccts',
'TR.AcctsReceivTradeNet',
'TR.STNotesReceivable'
],
parameters = {
'CH' : 'In',
'SDate' : '1997-01-01',
'EDate' : '2018-12-31',
'DivPayType' :' SDI:SCA:CSA'
}
)

Best Answer

  • I think that is how the dataframe is printed to the console. However, if you use pandas.DataFrame.to_string() function to convert the data to string, it will print the data without '\'.

    df, err = ek.get_data(  instruments=[
    '1801.T',
    ],
    fields = [
    'TR.Cash',
    'TR.CashAndEquivalents',
    'TR.ShortTermInvestments',
    'TR.CashAndSTInvestments',
    'TR.AcctsReceivTradeGross',
    'TR.ProvsnForDoubtfulAccts',
    'TR.AcctsReceivTradeNet',
    'TR.STNotesReceivable'
    ],
    parameters = {
    'CH' : 'In',
    'SDate' : '1997-01-01',
    'EDate' : '2018-12-31',
    'DivPayType' :' SDI:SCA:CSA'
    })

    print(df.to_string())

    image

    Otherwise, you can also iterate the returned dataframe to get the data.

Answers