how to fix my problem in sql server ?

  • get only columns data1,data2 from first index with 'a', 'b' and for each one only the 2nd index val=1

    filter_1 = multi_indexed_DF.loc[(['a','b'], 1), ['data1','data2']]

    # get only those entries where data1 is more than 0.5 (random numbers so the result varies)

    filter_2 = multi_indexed_DF.loc[multi_indexed_DF.data1 > 0.5]

  • Looks like a poorly worded homework question, with half the information missing.

  • Coinbaseterrijofrdn wrote:

    get only columns data1,data2 from first index with 'a', 'b' and for each one only the 2nd index val=1 filter_1 = multi_indexed_DF.loc[(['a','b'], 1), ['data1','data2']]

    # get only those entries where data1 is more than 0.5 (random numbers so the result varies) filter_2 = multi_indexed_DF.loc[multi_indexed_DF.data1 > 0.5]

    We cannot see your screen.  The info you have provided gives us nothing to go on.

    Do you have a SQL Statement?  An execution plan?  The table schema?

    Please take a look at the link in my signature line.  That should provide you with the details on how to ask a question so that you can get a good answer faster.

    Michael L John
    If you assassinate a DBA, would you pull a trigger?
    To properly post on a forum:
    http://www.sqlservercentral.com/articles/61537/

  • I don't think there is enough to go on based on what you wrote.  Plus, what you wrote does not look like TSQL; it looks more like .NET.

    So, if you want help in .NET (not SQL Server), that is a different battle.  We have no idea what the datatypes of any of those objects are or what any of those functions do or expect as parameters.  BUT my best guess is that multi_index_DF is an object that has a "location" which is an array of some sort as it looks like you are trying to supply 2 values and if memory serves, [] are used to indicate an array element.

    Now, if this is in SQL, I think you need to redefine what you mean by "index".  In SQL you don't pull data from an index, you pull it from a table which can have columns and rows.  Now, SQL HAS indexes, but you don't reference them directly... usually, and even if you do, an index only has values that are stored in the table in a specific column... usually. For sake of simplicity, lets say both previous statements are always true.  So that being said, what column(s) contain an a or b?  and what column(s) contain a value of 1?

    Now, if this is unrelated to SQL Server (a Microsoft product), like I suspect based on the sample code provided, I think we need a lot more to go on.

    The above is all just my opinion on what you should do. 
    As with all advice you find on a random internet forum - you shouldn't blindly follow it.  Always test on a test server to see if there is negative side effects before making changes to live!
    I recommend you NEVER run "random code" you found online on any system you care about UNLESS you understand and can verify the code OR you don't care if the code trashes your system.

  • It's a prelude to spam.  Go look at the profile of the op.  They do this kind of crap to "reserve a spot" and then they come back after the spam filters have passed the junk post they made and edit it.

    I know there are some real newbies out there but even a newbie wouldn't have posted something this far off.

     

     

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Spot on Jeff... I never think to check the profile before replying...

    Seeing something like "gemini support team" in the profile then seeing a question posted that doesn't seem to make sense and kind of looks like a homework question doesn't give me much faith in the Gemini support team...

    The above is all just my opinion on what you should do. 
    As with all advice you find on a random internet forum - you shouldn't blindly follow it.  Always test on a test server to see if there is negative side effects before making changes to live!
    I recommend you NEVER run "random code" you found online on any system you care about UNLESS you understand and can verify the code OR you don't care if the code trashes your system.

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply