How can I solve this error “ too many indices for array in my data ?”How can I represent an 'Enum' in Python?How can I do a line break (line continuation) in Python?How can I safely create a nested directory?How can I remove a trailing newline in Python?How can I make a time delay in Python?How can you profile a Python script?How can I count the occurrences of a list item?How can I reverse a list in Python?How can I print literal curly-brace characters in python string and also use .format on it?How do I write JSON data to a file?

Is there a set of positive integers of density 1 which contains no infinite arithmetic progression?

UTC timestamp format for launch vehicles

How can I remove material from this wood beam?

How to publish items after pipeline is finished?

What does a topology do, and what makes a particular topology the 'right' one?

Should I refuse being named as co-author of a bad quality paper?

Should I put programming books I wrote a few years ago on my resume?

Smart-expansion of a range to a list of numbers

Can the removal of a duty-free sales trolley result in a measurable reduction in emissions?

Can a human be transformed into a Mind Flayer?

Has there been a multiethnic Star Trek character?

AMPScript SMS InsertDE() function not working in SMS

I have a problematic assistant manager, but I can't fire him

Advantages of the Exponential Family: why should we study it and use it?

How to communicate to my GM that not being allowed to use stealth isn't fun for me?

Understanding "Current Draw" in terms of "Ohm's Law"

How can one's career as a reviewer be ended?

Next date with distinct digits

Electricity free spaceship

With Ubuntu 18.04, how can I have a hot corner that locks the computer?

Is it expected that a reader will skip parts of what you write?

Neat redistribution of association values

Russian word for a male zebra

Non-aqueous eyes?



How can I solve this error “ too many indices for array in my data ?”


How can I represent an 'Enum' in Python?How can I do a line break (line continuation) in Python?How can I safely create a nested directory?How can I remove a trailing newline in Python?How can I make a time delay in Python?How can you profile a Python script?How can I count the occurrences of a list item?How can I reverse a list in Python?How can I print literal curly-brace characters in python string and also use .format on it?How do I write JSON data to a file?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















This type of data contains, integers either positive and negative and whole numbers this file has an array of 368 rows and 143 columns.



import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

databogota2 = pd.read_csv('datosairebogota.csv')

#List of the atributes
list(databogota2.columns.values)

df = databogota2.drop(databogota2.columns[[0, 1]], axis=1)
df1 = df.drop(df.index[367])
df2 = df1.iloc[:,:].values

from sklearn.preprocessing import Imputer

imputer = Imputer(missing_values= np.nan, strategy='mean' , axis = 0)
imputer = imputer.fit(df2[:,0:144])
df2[:,0,144] = imputer.transform(df2[:,0,144])

#I will expect to get as output that the "nan" values become filling for mean of the columns each.


This is the error it generates.



Traceback (most recent call last):

File "<ipython-input-60-7cca9cc68b6f>", line 5, in <module>
df2[:,0,144] = imputer.transform(df2[:,0,144])

IndexError: too many indices for array


I was trying to solve the problem by looking some wrong format into the file however it has not solved the problem.










share|improve this question
























  • Please post the full error, mainly, tell us where the error occurs.

    – dedObed
    Mar 24 at 19:17

















0















This type of data contains, integers either positive and negative and whole numbers this file has an array of 368 rows and 143 columns.



import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

databogota2 = pd.read_csv('datosairebogota.csv')

#List of the atributes
list(databogota2.columns.values)

df = databogota2.drop(databogota2.columns[[0, 1]], axis=1)
df1 = df.drop(df.index[367])
df2 = df1.iloc[:,:].values

from sklearn.preprocessing import Imputer

imputer = Imputer(missing_values= np.nan, strategy='mean' , axis = 0)
imputer = imputer.fit(df2[:,0:144])
df2[:,0,144] = imputer.transform(df2[:,0,144])

#I will expect to get as output that the "nan" values become filling for mean of the columns each.


This is the error it generates.



Traceback (most recent call last):

File "<ipython-input-60-7cca9cc68b6f>", line 5, in <module>
df2[:,0,144] = imputer.transform(df2[:,0,144])

IndexError: too many indices for array


I was trying to solve the problem by looking some wrong format into the file however it has not solved the problem.










share|improve this question
























  • Please post the full error, mainly, tell us where the error occurs.

    – dedObed
    Mar 24 at 19:17













0












0








0








This type of data contains, integers either positive and negative and whole numbers this file has an array of 368 rows and 143 columns.



import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

databogota2 = pd.read_csv('datosairebogota.csv')

#List of the atributes
list(databogota2.columns.values)

df = databogota2.drop(databogota2.columns[[0, 1]], axis=1)
df1 = df.drop(df.index[367])
df2 = df1.iloc[:,:].values

from sklearn.preprocessing import Imputer

imputer = Imputer(missing_values= np.nan, strategy='mean' , axis = 0)
imputer = imputer.fit(df2[:,0:144])
df2[:,0,144] = imputer.transform(df2[:,0,144])

#I will expect to get as output that the "nan" values become filling for mean of the columns each.


This is the error it generates.



Traceback (most recent call last):

File "<ipython-input-60-7cca9cc68b6f>", line 5, in <module>
df2[:,0,144] = imputer.transform(df2[:,0,144])

IndexError: too many indices for array


I was trying to solve the problem by looking some wrong format into the file however it has not solved the problem.










share|improve this question
















This type of data contains, integers either positive and negative and whole numbers this file has an array of 368 rows and 143 columns.



import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

databogota2 = pd.read_csv('datosairebogota.csv')

#List of the atributes
list(databogota2.columns.values)

df = databogota2.drop(databogota2.columns[[0, 1]], axis=1)
df1 = df.drop(df.index[367])
df2 = df1.iloc[:,:].values

from sklearn.preprocessing import Imputer

imputer = Imputer(missing_values= np.nan, strategy='mean' , axis = 0)
imputer = imputer.fit(df2[:,0:144])
df2[:,0,144] = imputer.transform(df2[:,0,144])

#I will expect to get as output that the "nan" values become filling for mean of the columns each.


This is the error it generates.



Traceback (most recent call last):

File "<ipython-input-60-7cca9cc68b6f>", line 5, in <module>
df2[:,0,144] = imputer.transform(df2[:,0,144])

IndexError: too many indices for array


I was trying to solve the problem by looking some wrong format into the file however it has not solved the problem.







python






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 24 at 22:07









dedObed

690414




690414










asked Mar 24 at 17:16









Rafael Alberto Solorzano BuendRafael Alberto Solorzano Buend

13




13












  • Please post the full error, mainly, tell us where the error occurs.

    – dedObed
    Mar 24 at 19:17

















  • Please post the full error, mainly, tell us where the error occurs.

    – dedObed
    Mar 24 at 19:17
















Please post the full error, mainly, tell us where the error occurs.

– dedObed
Mar 24 at 19:17





Please post the full error, mainly, tell us where the error occurs.

– dedObed
Mar 24 at 19:17












1 Answer
1






active

oldest

votes


















0














I think you want column 0 to 144. If I am getting your problem than you can do this to get out your problem.



df.iloc[:,0:144] means you are getting all the rows of column 0 to 144.



Change your last line to



df2.iloc[:,0:144] = imputer.transform(df2.iloc[:,0:144])

df2.iloc[starting_index_of_row:ending_index_of_row , starting_index_of_column:ending_index_of_column]


I hope my answer will solve your problem thank you.






share|improve this answer

























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55326405%2fhow-can-i-solve-this-error-too-many-indices-for-array-in-my-data%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    I think you want column 0 to 144. If I am getting your problem than you can do this to get out your problem.



    df.iloc[:,0:144] means you are getting all the rows of column 0 to 144.



    Change your last line to



    df2.iloc[:,0:144] = imputer.transform(df2.iloc[:,0:144])

    df2.iloc[starting_index_of_row:ending_index_of_row , starting_index_of_column:ending_index_of_column]


    I hope my answer will solve your problem thank you.






    share|improve this answer





























      0














      I think you want column 0 to 144. If I am getting your problem than you can do this to get out your problem.



      df.iloc[:,0:144] means you are getting all the rows of column 0 to 144.



      Change your last line to



      df2.iloc[:,0:144] = imputer.transform(df2.iloc[:,0:144])

      df2.iloc[starting_index_of_row:ending_index_of_row , starting_index_of_column:ending_index_of_column]


      I hope my answer will solve your problem thank you.






      share|improve this answer



























        0












        0








        0







        I think you want column 0 to 144. If I am getting your problem than you can do this to get out your problem.



        df.iloc[:,0:144] means you are getting all the rows of column 0 to 144.



        Change your last line to



        df2.iloc[:,0:144] = imputer.transform(df2.iloc[:,0:144])

        df2.iloc[starting_index_of_row:ending_index_of_row , starting_index_of_column:ending_index_of_column]


        I hope my answer will solve your problem thank you.






        share|improve this answer















        I think you want column 0 to 144. If I am getting your problem than you can do this to get out your problem.



        df.iloc[:,0:144] means you are getting all the rows of column 0 to 144.



        Change your last line to



        df2.iloc[:,0:144] = imputer.transform(df2.iloc[:,0:144])

        df2.iloc[starting_index_of_row:ending_index_of_row , starting_index_of_column:ending_index_of_column]


        I hope my answer will solve your problem thank you.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Mar 26 at 5:17









        marc_s

        592k13311341279




        592k13311341279










        answered Mar 24 at 22:23









        Sohaib AnwaarSohaib Anwaar

        10810




        10810



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55326405%2fhow-can-i-solve-this-error-too-many-indices-for-array-in-my-data%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현