Skip to content

Tag: python

Getting SQL Column to print in Python

I have a code that prints out a specific column from an SQL query table. It prints out fine however I would like it to be put into a file and I cannot think of how to do that. Here is what I have: I was thinking of newfile.write( df[[‘PartNumber’]].to_string() ) however that did not work. Thank yo…

Reshape 3-d array to 2-d

I want to change my array type as pd.DataFrame but its shape is: I’ve tried to reshape by the following code, but it didn’t work: How can I change its shape? Answer NumPy array dimensions can be reduced using various ways; some are: using np.squeeze: using np.reshape: or with using -1 in np.reshap…