0

I've saved some data of mine in a csv file using pandas (from a dict) and if I'm looking at it or printing it I'm getting 3 dots in the middle of the information. I think it might be because the string is too long.

Example:

[-1.19583108e-02,  7.44251342e-03, -1.35046719e-02, ..., 1.01258847e-03, -4.75816538e-03,  1.09870630e-02]

When it should've been about 300 different numbers.

Is there any solution?

Explanation: Let's say I have a numpy array of 300 entries (we'll call it arr). I want to store this array in a csv file under the header of test. So I read the csv file (using pd.read_csv function) and try to get this array by using: df['test'].iloc[0]. Now even if I'm using the commands that I was suggested in the answers - I still get dots (because I think it was saved this way). What I actually want to do is to eval this string to get an actual numpy array and use it as an array, but what I get instead is this: error

I figured the ellipsis object is the 3 dots I don't want to get.

11
  • You want to see the whole data in the terminal or console ? Commented Sep 19, 2021 at 8:49
  • 2
    Does this answer your question? How do I expand the output display to see more columns of a Pandas DataFrame? Also stackoverflow.com/q/49188960/4046632 Commented Sep 19, 2021 at 8:52
  • If the dots are inside the cs file, post the code you actually use to write to the file. Ideally show minimal reproducible example. Commented Sep 19, 2021 at 8:55
  • @azro I don't want to print everything, but when I eval this code I should get an array with about 300 numbers in it, but I get the wrong array Commented Sep 19, 2021 at 8:59
  • @buran same message^ Commented Sep 19, 2021 at 9:00

1 Answer 1

1

Just add the following in the beginning of your code:

import sys
numpy.set_printoptions(threshold=sys.maxsize)

Edit:

Try:

df.loc[df[0] != ...]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.