Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

in python, i am using pandas to read a csv file when its working fine tho with other functions but facing an error while using a line

i imported panda as pd

   dataset = pd.read_csv('C:\\Users\\Adminis....')

   dataset.plot(x='tempmin', y='tempmax', style='o')
   pit.show()
   
   pit.figure(figsize=(15,10)) #these are working fine
   pit.tight_layout()
   seaborninstance.distplot(dataset['tempmax'])
   pit.show()
   but i am getting in trouble while using this
   x = dataset['tempmin'].values.reshape(-1,-1)
   y = dataset['tempmax'].values.reshape(-1,-1)

   x = dataset['tempmin'].values.reshape(-1,-1)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   ValueError: can only specify one unknown dimension

i was expecting to use this to train my algo but i am stuck on a variable??

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Only one dimension size can be unspecified in reshape function. I guess you want to convert the dataframe columns to column vectors to feed into some training module, then you need to reshape to (-1, 1) not (-1, -1), i.e.

   x = dataset['tempmin'].values.reshape(-1, 1)
   y = dataset['tempmax'].values.reshape(-1, 1)
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading