between   545
numpy.random.randint — NumPy v1.14 Manual
useful method for getting either an array or a 2D matrix of randomly generated integers between two numbers.

e.g.

Get a Numpy array of 100 numbers between 0 and 50

arr1 = np.random.randint(0,50, 100)

Now, suppose you want that same data in a 5 by 10 matrix. You can do this like so:

matrix_1 = arr1.reshape(5,10)
numpy  documentation  guide  reference  random  randint  method  generate  integers  between  minimum  maximum  rows  columns  shape  howto  example
4 days ago by racl101
How to select rows in a DataFrame between two values, in Python Pandas? - Stack Overflow
If you want to derive a dataframe containing all values in any given row, column position between two numbers you can do this:

newdf = df[(df >= val1) & (df <=val2)]

it will return a new dataframe with same shape (same row and column count) but any value that doesn't fall between val1 and val2 it replaces with an NaN value.
stackoverflow  howto  pandas  python  python2.7  select  filter  rows  dataframe  between  two  values  example  guide  reference  named  columns  labelled
4 days ago by racl101
Michael Cohen and the End Stage of the Trump Presidency | The New Yorker
t politics
Michael Cohen and the End Stage of the Trump Presidency
Adam Davidson
On May 1, 2003, the day President George W. Bush landed on the U.S.S. Abraham Lincoln in front of the massive “Mission Accomplished” sign, I was in Baghdad performing what had become a daily ritual. I went to a gate on the side of the Republican Palace, in the Green Zone, where an American soldier was receiving, one by one, a long line of Iraqis who came with questions and complaints. I remember a man complaining that his house had been run over by a tank. There was a woman who had been a government employee and wanted to know about her salary. The soldier had a form he was supposed to fill out with each person’s request and that person’s contact information. I stood there as the man talked to each person and, each time, said, “Phone number?” And each person would answer some version of “The phone system of Iraq has been destroyed and doesn’t work.” Then the soldier would turn to the next person, write down the person’s question or complaint, and then ask, “Phone number?”
I arrived in Baghdad on April 12th of that year, a few days after Saddam’s statue at Firdos Square had been destroyed. There were a couple of weeks of uncertainty as reporters and Iraqis tried to gauge who was in charge of the country and what the general plan was. There was no electricity, no police, no phones, no courts, no schools. More than half of Iraqis worked for the government, and there was no government, no Army, and so no salaries for most of the country. At first, it seemed possible that the Americans simply needed a bit of time to communicate the new rules. By the end of April, though, it was clear: there was no plan, no new order. Iraq was anarchic.
We journalists were able to use generators and satellite dishes to access outside information, and what we saw was absurd. Americans seemed convinced things were going well in Iraq. The war—and the President who launched it—were seen favorably by seventy per cent of Americans. Then came these pictures of a President touting “Mission Accomplished”—the choice of words that President Trump used in a tweet on Saturday, the morning after he ordered an air strike on Syria. On the ground, we were not prophets or political geniuses. We were sentient adults who were able to see the clear, obvious truth in front of us. The path of Iraq would be decided by those who thrived in chaos.
I had a similar feeling in December, 2007. I came late to the financial crisis. I had spent much of 2006 and 2007 naïvely swatting away warnings from my friends and sources who told me of impending disaster. Finally, I decided to take a deep look at collateralized debt obligations, or C.D.O.s, those financial instruments that would soon be known as toxic assets. I read technical books, talked to countless experts, and soon learned that these were, in Warren Buffett’s famous phrase, weapons of financial mass destruction. They were engineered in such a way that they could exponentially increase profits but would, also, exponentially increase losses. Worse, they were too complex to be fully understood. It was impossible, even with all the information, to figure out what they were worth once they began to fail. Because these C.D.O.s had come to form the core value of most major banks’ assets, no major bank had clear value. With that understanding, the path was clear. Eventually, people would realize that the essential structure of our financial system was about to implode. Yet many political figures and TV pundits were happily touting the end of a crisis. (Larry Kudlow, now Trump’s chief economic adviser, led the charge of ignorance.)
In Iraq and with the financial crisis, it was helpful, as a reporter, to be able to divide the world into those who actually understand what was happening and those who said hopeful nonsense. The path of both crises turned out to be far worse than I had imagined.
I thought of those earlier experiences this week as I began to feel a familiar clarity about what will unfold next in the Trump Presidency. There are lots of details and surprises to come, but the endgame of this Presidency seems as clear now as those of Iraq and the financial crisis did months before they unfolded. Last week, federal investigators raided the offices of Michael Cohen, the man who has been closer than anybody to Trump’s most problematic business and personal relationships. This week, we learned that Cohen has been under criminal investigation for months—his e-mails have been read, presumably his phones have been tapped, and his meetings have been monitored. Trump has long declared a red line: Robert Mueller must not investigate his businesses, and must only look at any possible collusion with Russia. That red line is now crossed and, for Trump, in the most troubling of ways. Even if he were to fire Deputy Attorney General Rod Rosenstein and then had Mueller and his investigation put on ice, and even if—as is disturbingly possible—Congress did nothing, the Cohen prosecution would continue. Even if Trump pardons Cohen, the information the Feds have on him can become the basis for charges against others in the Trump Organization.
This is the week we know, with increasing certainty, that we are entering the last phase of the Trump Presidency. This doesn’t feel like a prophecy; it feels like a simple statement of the apparent truth. I know dozens of reporters and other investigators who have studied Donald Trump and his business and political ties. Some have been skeptical of the idea that President Trump himself knowingly colluded with Russian officials. It seems not at all Trumpian to participate in a complex plan with a long-term, uncertain payoff. Collusion is an imprecise word, but it does seem close to certain that his son Donald, Jr., and several people who worked for him colluded with people close to the Kremlin; it is up to prosecutors and then the courts to figure out if this was illegal or merely deceitful. We may have a hard time finding out what President Trump himself knew and approved.
However, I am unaware of anybody who has taken a serious look at Trump’s business who doesn’t believe that there is a high likelihood of rampant criminality. In Azerbaijan, he did business with a likely money launderer for Iran’s Revolutionary Guard. In the Republic of Georgia, he partnered with a group that was being investigated for a possible role in the largest known bank-fraud and money-laundering case in history. In Indonesia, his development partner is “knee-deep in dirty politics”; there are criminal investigations of his deals in Brazil; the F.B.I. is reportedly looking into his daughter Ivanka’s role in the Trump hotel in Vancouver, for which she worked with a Malaysian family that has admitted to financial fraud. Back home, Donald, Jr., and Ivanka were investigated for financial crimes associated with the Trump hotel in SoHo—an investigation that was halted suspiciously. His Taj Mahal casino received what was then the largest fine in history for money-laundering violations.
Listing all the financial misconduct can be overwhelming and tedious. I have limited myself to some of the deals over the past decade, thus ignoring Trump’s long history of links to New York Mafia figures and other financial irregularities. It has become commonplace to say that enough was known about Trump’s shady business before he was elected; his followers voted for him precisely because they liked that he was someone willing to do whatever it takes to succeed, and they also believe that all rich businesspeople have to do shady things from time to time. In this way of thinking, any new information about his corrupt past has no political salience. Those who hate Trump already think he’s a crook; those who love him don’t care.
I believe this assessment is wrong. Sure, many people have a vague sense of Trump’s shadiness, but once the full details are better known and digested, a fundamentally different narrative about Trump will become commonplace. Remember: we knew a lot about problems in Iraq in May, 2003. Americans saw TV footage of looting and heard reports of U.S. forces struggling to gain control of the entire country. We had plenty of reporting, throughout 2007, about various minor financial problems. Somehow, though, these specific details failed to impress upon most Americans the over-all picture. It took a long time for the nation to accept that these were not minor aberrations but, rather, signs of fundamental crisis. Sadly, things had to get much worse before Americans came to see that our occupation of Iraq was disastrous and, a few years later, that our financial system was in tatters.
The narrative that will become widely understood is that Donald Trump did not sit atop a global empire. He was not an intuitive genius and tough guy who created billions of dollars of wealth through fearlessness. He had a small, sad operation, mostly run by his two oldest children and Michael Cohen, a lousy lawyer who barely keeps up the pretenses of lawyering and who now faces an avalanche of charges, from taxicab-backed bank fraud to money laundering and campaign-finance violations.
Cohen, Donald, Jr., and Ivanka monetized their willingness to sign contracts with people rejected by all sensible partners. Even in this, the Trump Organization left money on the table, taking a million dollars here, five million there, even though the service they provided—giving branding legitimacy to blatantly sketchy projects—was worth far more. It was not a company that built value over decades, accumulating assets and leveraging wealth. It burned through whatever good will and brand value it established as quickly as possible, then moved on to the next scheme.
There are important legal questions that remain. How much did Donald Trump and his children know about the criminality of their partners? How explicit were they in agreeing to put a shiny gold brand on top of corrupt deals? The answers to … [more]
Of  course  Trump  is  raging  and  furious  and  terrified.  Prosecutors  are  now  looking  at  his  core.  Cohen  was  the  key  intermediary  between  the  Trump  family  and  its  partners  around  the  world;  he  was  chief  consigliere  and  dealmaker  throughout  its  period  expansion  into  global  partnerships  with  sketchy  oligarchs.  wasn’t  a  slick  politico  who  showed  up  for  a  few  months.  knows  everything_  he  recorded  much  it_  and  now  will  know  it_  too.  It  seems  inevitable  that  much  will  be  made  public.  We  don’t  know  when.  We  don’t  know  the  precise  path  the  next  few  months  will  take.  There  will  be  resistance  and  denial  and  counterattacks.  But  seems  likely  that_  when  look  back  on  this  week_  will  see  as  a  turning  point.  We  are  now  in  the  end  stages  the  Trump  Presidency.  from iphone
6 days ago by soshdin
[GEEK TALK]What's the difference between KVM and QEMU? | sTRATOSCALE
Virtualization: What is the difference between KVM and QEMU?
Virtualization:  What  is  the  difference  between  KVM  and  QEMU?
9 days ago by kilroy2
Using Utopia to synchronise patterns between computers
Using Utopia to synchronise patterns between computers
sc  utopia  synchronise  patterns  between  computers  networking
5 weeks ago by gdw

Copy this bookmark:

description:

tags: