Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8180991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:22:23+00:00 2026-06-07T00:22:23+00:00

I am trying to run a Winsorized regression in pandas for Python. The very

  • 0

I am trying to run a Winsorized regression in pandas for Python. The very helpful user manual offers this example code:

winz = rets.copy()
std_1year = rolling_std(rets, 250, min_periods=20)
cap_level = 3 * np.sign(winz) * std_1year
winz[np.abs(winz) > 3 * std_1year] = cap_level
winz_model = ols(y=winz['AAPL'], x=winz.ix[:, ['GOOG']],window=250)

The fourth line looks wrong to me: shouldn’t the RHS be cap_level[np.abs(winz) > 3 * std_1year]?

Thanks for the help! I’m still new to using the Pandas dataframe and want to make sure I’m understanding right.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T00:22:25+00:00Added an answer on June 7, 2026 at 12:22 am

    Edit: sorry, misunderstood the question!

    You’re correct that this would be wrong for most types; however pandas.DataFrame has special support for setting values using a Boolean mask; it will select the corresponding values from the RHS with the corresponding time value. Under the hood it’s using np.putmask.

    You can check this for yourself:

    >>> df = pandas.DataFrame(np.linspace(0.0, 1.0, 10).reshape(5, 2))
    >>> df[df > 0.5] = -df
    >>> df
              0         1
    0  0.000000  0.111111
    1  0.222222  0.333333
    2  0.444444 -0.555556
    3 -0.666667 -0.777778
    4 -0.888889 -1.000000
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to run a very simple flot.js example, I have the following code to
Im trying to run this code . Basically I want the https://admin:qwerty123@ '$dmp':7777/set_param?'$params command
trying to run this basic form control example on msdn. At step 1 of
When trying run this code: At first it prints Process some_id BEFORE enter for
Trying to run this piece of code: void print_matrix(matrix* arg) { int i, j;
When I'm trying run below code in Oracle 11g , @?/rdbms/admin/prvtmail.plb I got this
When trying to run this code for i in range(N): jobs.append(mp.Process(None,G_Sim,(lmbda,mu,c,skip_cost,simulation_time,Policy,warmup_period,False,))) for j in
Situation: I'm trying run an https store (xcart) under one domain secure.example.com and I
Im trying to run exe file with c++ with no luck I tried this:
When trying to run the sample code here: http://www.nikhilk.net/Live-Search-REST-API.aspx I get: Error 52 The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.