Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to copy numpy variable values to clipboard in PyCharm?

If I rightclick and select Copy Value

enter image description here

it copies corrupted excerpt only:

enter image description here

In 21st century wasn't it possible to just send all the numbers to clipboard?

like image 801
Dims Avatar asked Nov 02 '17 15:11

Dims


People also ask

How do you copy an element from a Numpy array?

Conclusion: to copy data from a numpy array to another use one of the built-in numpy functions numpy. array(src) or numpy. copyto(dst, src) wherever possible.

Can PyCharm show variables?

PyCharm allows you to inspect variables in a dedicated dialog. This is useful when you need to keep track of some variable (or the object whose reference it holds) and at the same time be able to navigate between frames and threads. Right-click a variable on the Variables tab and select Inspect.

How do I copy a Numpy Matrix?

With the help of Numpy matrix. copy() method, we can make a copy of all the data elements that is present in matrix. If we change any data element in the copy, it will not affect the original matrix.

Is there a variable Explorer in PyCharm?

Go to python console in pycharm. On the right usually, in the special variables tab, scroll down and find your data frame or csv you want to visualize. Right click on the data frame/dataset and see for the option view as array/data frame. There you go, you can see a tab opened containing your data.


2 Answers

Say your NumPy array is mynparray. Then you can do

import pandas as pd
df = pd.DataFrame(mynparray)
df.to_clipboard(index=False,header=False)
like image 53
flow2k Avatar answered Sep 27 '22 14:09

flow2k


Looks like a PyCharm bug: max buffer size is 255.

Try this workaround: press Insert and evaluate print(dat). The value will be dumped to console, where copy is working fine.

Also you can go ahead and evaluate pyperclip.copy(str(dat)) to copy in python (see this question).

like image 43
Maxim Avatar answered Sep 26 '22 14:09

Maxim