Home>
I want to read and process data with pandas and make it into ndarray

Read csv file with pandas and change to ndarray format.
However, when I changed to ndarray, it changed to a completely different number.
Also, getting the maximum and minimum values ​​did not work.

Error message
[[nan nan nan nan
             nan nan]
 [2.57869902e + 04 2.58888203e + 04 2.57849004e + 04 2.58222891e + 04
  2.58222891e + 04 2.41620000e + 08]
 [2.58250605e + 04 2.58361602e + 04 2.57224297e + 04 2.57335996e + 04
  2.57335996e + 04 2.00480000e + 08]
 [2.57148594e + 04 2.57625605e + 04 2.56080195e + 04 2.56569805e + 04
  2.56569805e + 04 2.13270000e + 08]
 (2.56885801e + 04 2.58260508e + 04 2.56885801e + 04 2.57903496e + 04
  2.57903496e + 04 2.00330000e + 08]]
Open 2.582506e + 04
High 2.588882e + 04
Low 2.578490e + 04
Close 2.582229e + 04
Adj Close 2.582229e + 04
Volume 2.416200e + 08
dtype: float64
Open 2.568858e + 04
High 2.576256e + 04
Low 2.560802e + 04
Close 2.565698e + 04
Adj Close 2.565698e + 04
Volume 2.003300e + 08
dtype: float64
Applicable source code
import pandas as pd
dji = pd.read_csv ("DJI1.csv", index_col = 0)
print (dji.values)
print (dji.max ())
print (dji.min ())


Used csv file
https://drive.google.com/open?id=1f3KMq-tRdi5hJXiK11AYD_fNjEz7c4Pt

Tried

I tried it with another csv file and it worked.

import pandas
n225 = pd.read_csv ("N2251.csv", index_col = 0)
print (n225.values)
print (n225.max ())
print (n225.min ())
[[nan nan nan nan nan
           nan]
 [22110.539063 22306.830078 22053.140625 22219.730469 22219.730469
  54500.]
 [22270.039063 22390.199219 22162.810547 22362.550781 22362.550781
  57100.]
 [22420.669922 22463.029297 22377.880859 22410.820313 22410.820313
  50100.]
 [22484.009766 22602.240234 22452.419922 22601.769531 22601.769531
  50400.]]
Open 22484.009766
High 22602.240234
Low 22452.419922
Close 22601.769531
Adj Close 22601.769531
Volume 57100.000000
dtype: float64
Open 22110.539063
High 22306.830078
Low 22053.140625
Close 22219.730469
Adj Close 22219.730469
Volume 50100.000000
dtype: float64


Used csv file
https://drive.google.com/open?id=1FwR2WT9jFew8qL2Wpa5KhM0WKzYQVj7d

Supplemental information (FW/tool version etc.)

Python 3.6.5 :: Anaconda, Inc.

pandas == 0.23.0
jupyter == 1.0.0
jupyter-client == 5.2.3
jupyter-console == 5.2.0
jupyter-core == 4.4.0
numpy == 1.14.3

  • Answer # 1

    It seems that the reading itself is done normally just by displaying it in exponential notation.

    Exponential notation-Wikipedia

    When a number with a large digit is included, it will be converted to an exponential notation for easy viewing (pandas and numpy).

    If you want to change the appearance, please refer to this area and change the display format.

    Specify the display format of NumPy array ndarray (number of digits, exponential notation, zero padding, etc.) | note.nkmk.me

    Change display settings for pandas (number of decimal places, significant digits, maximum number of rows/columns, etc.) | note.nkmk.me

    If you get used to it, the exponent notation will make it easier to see.