Optimization – How can I vectorize and optimize the function in c to get random numbers?

I have programmed a function that generates random numbers.
However, I cannot get my compiler to vectorize this function.
How can I transform this function so that my compiler can vectorize it and shorten the execution time of the program?

    unsigned int seed;
    unsigned int temp;
    #define val13 13
    unsigned int var1 = 214013;
    unsigned int var2 = 2531011;
    inline int myRandom() {
      temp = var1*seed;
      seed = temp + var2;
      return (seed>>val13);
    }

vb.net – I think one of these functions is wasting memory. How can I optimize it?

I use these functions to save images in a database.

How do I use it? I create a form, upload a record, create the picture to be displayed in a PictureBox, and delete it when I close the form.

I say they are wasting resources because I see that closing the form does not clear the program's memory (from the Visual Studio Diagnostic Tools) until the garbage collector is submitted.

    Public Function ConvertImageToByteArray(img As Image) As Byte()

        Dim result As Byte()
        Dim myMemoryStream As New IO.MemoryStream()

        img.Save(myMemoryStream, Imaging.ImageFormat.Jpeg)
        myMemoryStream.Position = 0
        result = myMemoryStream.GetBuffer
        myMemoryStream.Close()
        myMemoryStream.Dispose()

        Return result

    End Function
    Public Function ConvertByteArrayToImage(arr As Byte()) As Image
        Dim resultado As Image

        Using Stream As New System.IO.MemoryStream(arr)
            Stream.Position = 0
            Dim result As Image = Image.FromStream(Stream)
            resultado = New Bitmap(result)
            result = Nothing
        End Using

        Return resultado
    End Function

This is an example of how I create the form.

Using frm As New frmCliente
  frm.Cliente = ClienteSeleccionado
  If (frm.ShowDialog() = DialogResult.OK) Then
      Cliente.Update(frm.Cliente)
  End If
End Using

Query performance – Optimize the SQL statement

I have the following SQL statement:

SELECT * FROM table p with (nolock)
WHERE
     p.col1 = 'string'
 and p.col2 not in ('string')
 and p.col3 = 1
 and p.col4 is null
 and (p.col5 in ( -- list of 20 strings )
    or p.col5 in ( -- list of 3000 strings )
     )
 and p.col6 not in ( -- list of 30 strings )

The execution takes 15 minutes and returns 775,000 lines.
None of the columns in the criteria is the primary key, and I'm not sure about other indexes.

Each line may contain a few kilobytes in different text columns.

To speed this up, requesting fewer columns (i.e. only the columns I need) makes this more efficient?

Are there other ways to speed this up, perhaps with indexes?

The amount returned is likely to be approximately 1/4000 the size of the database.

Performance – Optimize the position of the chess pieces on an index

This code is used to convert a chess piece position into an index.

A checkerboard figure describes its position with the file a-h (x-axis) and rank 1-8 (y-axis), so this can be represented with indices from 0 to 63.

56 57 58 59 60 61 62 63
48 49 50 51 52 53 54 55
40 41 42 43 44 45 46 47
32 33 34 35 36 37 38 39
24 25 26 27 28 29 30 31
16 17 18 19 20 21 22 23
 8  9 10 11 12 13 14 15
 0  1  2  3  4  5  6  7
 a                    h

The function accepts a string, which is a checkerboard position.

example
move = "b2"

b2 is index 9

public func getIndex(move:String) -> Int {
  let base:(Int) =  (0,1,2,3,4,5,6,7)
  let rank:(Int) = base.map { $0 * 8 }
  let x:String = move.substring(to: 1)
  let y:String = move.substring(from: 1)
  let v:Int = Int(y) ?? 0
  switch x {
    case "a": return base(0) + rank(v - 1)
    case "b": return base(1) + rank(v - 1)
    case "c": return base(2) + rank(v - 1)
    case "d": return base(3) + rank(v - 1)
    case "e": return base(4) + rank(v - 1)
    case "f": return base(5) + rank(v - 1)
    case "g": return base(6) + rank(v - 1)
    case "h": return base(7) + rank(v - 1)
    default: return 0
  }
}

Can anyone suggest ways for a faster approach?

8 – How do I optimize the Glyphicons font with font-display: swap?

I want to optimize glyphicons font loading for the Google PageSpeed ​​Insights tool. I need to apply the following CSS code:

font-display: swap

Here is the location of my font:
https://www.example.com/themes/custom/bootstrap_subtheme_front_office_old/bootstrap/assets/fonts/bootstrap/glyphicons-halflings-regular.woff2

I have the following code in the style.scss File of my subtopic and I have compiled the topic, but Google still says I should apply font-display: swap;

@font-face {
  font-family: 'Glyphicons Halflings';
  src: url('../bootstrap/assets/fonts/bootstrap/glyphicons-halflings-regular.woff2') format('woff2');
  font-display: swap;
}

Enter the image description here

Here is the beginning of mine style.css File:

@font-face{font-family:Lato;font-style:normal;font-weight:400;src:local("Lato Regular"),local("Lato-Regular"),url(../fonts/lato-v16-latin-ext_latin-regular.woff2) format("woff2");font-display:swap}@font-face{font-family:Lato;font-style:normal;font-weight:700;src:local("Lato Bold"),local("Lato-Bold"),url(../fonts/lato-v16-latin-ext_latin-700.woff2) format("woff2");font-display:swap}@font-face{font-family:Lato;font-style:italic;font-weight:400;src:local("Lato Italic"),local("Lato-Italic"),url(../fonts/lato-v16-latin-ext_latin-italic.woff2) format("woff2");font-display:swap}@font-face{font-family:Glyphicons Halflings;src:url(../bootstrap/assets/fonts/bootstrap/glyphicons-halflings-regular.woff2) format("woff2");font-display:swap}
/*!
 * Bootstrap v3.3.7 (http://getbootstrap.com)
 * Copyright 2011-2016 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 */
/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}body{margin:0}
...

Why do font-display: swap Don't want to apply?

https://developers.google.com/speed/pagespeed/insights/?hl=fr&url=https%3A%2F%2Fdev.s1biose.com%2Ffr&tab=desktop

Performance – How can I optimize my Google Apps script to not exceed the maximum time limit?

I'm trying to prevent my script from exceeding the maximum execution time, but I'm not sure how to optimize my code. The part that really hangs is when the file is an APR. It has to unzip 69 files, convert them to Google Docs format and then overwrite the existing tabs on a Google Sheet. Thank you so much!

//version 1_20200306

function doGet(e) {
  try {
    var rn = e.parameter.responseNumber;  // takes the response number as a parameter
    rn = Number(rn);  // sets the response number into a variable
    rn = rn + 1;  // increments the response number by 1 to designate the row number

    // begins processing the report form entry
    var reportStatus = processReportForm(rn);

    // if a good status is returned then the script redirects to the success page
    if (reportStatus == "good") {
      var output = HtmlService.createHtmlOutputFromFile(reportStatus);
      return output;
    }

  }
  catch(err) {
    var output = HtmlService.createHtmlOutputFromFile('failure');
    return output;
  }
};

// gets the most recent file added to the folder
function getLatestFileId(recentFileFolder){

  var folder = DriveApp.getFoldersByName(recentFileFolder);
  var files = folder.next().getFiles();
  var lastFileId = files.next().getId();

  return lastFileId.toString();

};

// checks to see if demo report code is present
function demoCheckReportCode(rcCheck,rType) {

  if(rcCheck == 'demo' && rType == 'APR') {
    var rcDemoCheckName = '1vH4SidDb6QctTdBtvIUxjpE3RRmZPMo8_fQcNUJqWV0';
  } else if (rcCheck == "demo" && rType == 'SysPM') {
    var rcDemoCheckName = '1D2QJkM0odQBQia9Q2qHGwC_iKHidfvfbQv1xDR6yygk';
  } else if (rcCheck == "demo" && rType == 'SysPM Resubmitted') {
    var rcDemoCheckName = '1D2QJkM0odQBQia9Q2qHGwC_iKHidfvfbQv1xDR6yygk';
  }else if (rcCheck == "demo" && rType == 'CSV') {
    var rcDemoCheckName = '1Wqi6qykTMlMCaoDF1JfE1bOk0H_SykydtCnC2jFoTgI';
  } else {
    var rcDemoCheckName = rcCheck;
  }
  return rcDemoCheckName;
};

// checks to see if report code is demo and returns the folder ID to use
function demoCheckFolderId(fIdCheck) {

  if (fIdCheck == '1vH4SidDb6QctTdBtvIUxjpE3RRmZPMo8_fQcNUJqWV0' ||
      fIdCheck == '1D2QJkM0odQBQia9Q2qHGwC_iKHidfvfbQv1xDR6yygk' ||
      fIdCheck == '1Wqi6qykTMlMCaoDF1JfE1bOk0H_SykydtCnC2jFoTgI') {
    var rcDemoCheckId = '1b-1Ll2O1ZsDztzwoGUnNiPbAVq5-bHXa';
  } else {
    var rcDemoCheckId = getFolderByName(fIdCheck);
  }
  return rcDemoCheckId;
};

function processReportForm(rNumber) {

  var rsId = '11NR47rtjTtdYDK7ZmXDZ38VCC9xRBsiwrixNXfqbjOk'; // ID of Report Submission Form
  var rs = SpreadsheetApp.openById(rsId)
  var sheet = rs.getSheets()(0);
  var rowNumber = rNumber;
  var contactName = sheet.getRange('E' + rowNumber).getValue();
  var reportFileName = sheet.getRange('F' + rowNumber).getValue();
  var dashboardName = sheet.getRange('G' + rowNumber).getValue();
  var reportCode = sheet.getRange('H' + rowNumber).getValue();
  var emailAddress = sheet.getRange('I' + rowNumber).getValue();
  var info = sheet.getRange('M' + rowNumber).getValue();
  var type = sheet.getRange('K' + rowNumber).getValue();
  var period = sheet.getRange('L' + rowNumber).getValue();
  var dataSheetName = 'DATA';

  // checks to see if demo report is being used
  reportCode = demoCheckReportCode(reportCode,type);

  // checks to see if folder has files in it
  var etlStatus = checkFolder(reportCode);

  // returns status of etl
  if (etlStatus == reportCode) {
    return etlStatus;
  }

  // takes input form info and adds it to data sheet
  var ds = SpreadsheetApp.openById(reportCode)
  var dataSheet = ds.getSheets()(0);

  if(type == 'SysPM') {
    dataSheet.getRange('B8').setValue('NO');
  } else if(type == 'SysPM Resubmitted') {
    dataSheet.getRange('B8').setValue('YES');
  }

  // processes uploaded data
  importData(type,reportCode,reportFileName,dataSheetName);

  dataSheet.getRange('B2').setValue(dashboardName);
  dataSheet.getRange('B3').setValue(period);
  dataSheet.getRange('B4').setValue(info);

  // returns etl status
  return etlStatus;
};

function importData(tc,rc,rfn,dsn) {

  // demo report check folder ID
  var folderId = demoCheckFolderId(rc);

  var spreadsheet = rc; // spreadsheet where data goes
  var reportName = rfn; // report file name

  // checks report type
  if(tc == 'APR') {

    // unzip report with csv files and delete report file
    unZipItAPR(folderId,reportName);

    var vFolder = DriveApp.getFolderById(folderId); // gets folder ID
    var vFiles = vFolder.getFiles(); // populates with a list of files in the folder

    // gets the names of the files in the folder
    while (vFiles.hasNext()) {
      var file = vFiles.next();
      var csvName = file.getName();
      if (csvName != 'Q4a.csv' 
      && csvName != 'Q6e.csv'
      && csvName != 'Q6f.csv'
      && csvName != 'Q7b.csv'
      && csvName != 'Q8b.csv'
      && csvName != 'Q9a.csv'
      && csvName != 'Q9b.csv') {

        // imports csv files into spreadsheet
        importFile(file.getName(),folderId,spreadsheet);
      }
    }

    // converts csv files to Google Sheets format
    convert(folderId);

    var csvFiles = vFolder.getFiles();
      // copies files into data folder
      while (csvFiles.hasNext()) {
        var file = csvFiles.next();
        var Q5aSheetName = file.getName();

        var csvSheet = SpreadsheetApp.openById(file.getId());
        var Q5aSheet = csvSheet.getSheets()(0);
        var testValue1 = Q5aSheet.getRange('A1').getValue();
        var testValue2 = Q5aSheet.getRange('B1').getValue();

        if (testValue1 == '' && testValue2 == '') {
          Q5aSheet.deleteRow(1);
        }

        // clones the report sheets to the data sheet
        cloneGoogleSheet(file.getId(),spreadsheet,Q5aSheetName,Q5aSheetName);
      }

    // checks report type
  } else if(tc == 'SysPM' || tc == 'SysPM Resubmitted') {

    // converts xls to google sheets format
    var sourceFileId = convertExceltoGoogleSpreadsheet(folderId,reportName);
    if(tc == 'SysPM') {
      var sourceSheetNameOne = 'SysPMSummary2016_1';
      var destSheetNameOne = 'SysPMSummary2016_1';
    } else if(tc == 'SysPM Resubmitted') {
      var sourceSheetNameOne = 'SysPMSummary2016Rev';
      var destSheetNameOne = 'SysPMSummary2016Rev';
    }
    var sourceSheetNameTwo = 'SysPMSummary';
    var destSheetNameTwo = 'SysPMSummary';

    // clones the report sheets to the data sheet
    cloneGoogleSheet(sourceFileId,spreadsheet,sourceSheetNameOne,destSheetNameOne);
    cloneGoogleSheet(sourceFileId,spreadsheet,sourceSheetNameTwo,destSheetNameTwo);
  } else if(tc == 'CSV') {

    // unzip report with csv files and delete report file
    unZipItCSV(folderId,reportName);

    // converts csv files to Google Sheets format
    convert(folderId);

    var vFolder = DriveApp.getFolderById(folderId); // gets folder ID
    var vFiles = vFolder.getFiles(); // populates with a list of files in the folder
    var thisFile = DriveApp.getFileById(rc);

    var parentFold = thisFile.getParents(); // Get all parents - normally just one parent
    var targetFolder = parentFold.next(); // Get the first parent folder
    var targetFolderFiles = targetFolder.getFiles(); // populates with a list of files in the folder
    var dateFile = DriveApp.getFileById('1jj97O7RxPQzV3kpqUlYwI5HIQS6BcSsV-w0HAiJUTio'); //Master Dates file id

    // makes a copy of the Master Dates file into the upload folder
    dateFile.makeCopy(vFolder).setName(dateFile.getName());

    // copies files into data folder
    while (vFiles.hasNext()) {
      var file = vFiles.next();
      if (file.getName() == 'Client'||
          file.getName() == 'Enrollment'||
          file.getName() == 'Exit'||
          file.getName() == 'HealthAndDV'||
          file.getName() == 'Master Dates'||
          file.getName() == 'Project') {

          // removes unnecessary columns
          deleteColumns(file.getId(),file.getName());

          // gets current file/sheet name
          var sheetName = file.getName();

          // clones the report sheets to the data sheet
          cloneGoogleSheet(file.getId(),spreadsheet,sheetName,sheetName);
      }
    }
  }
};

// unzips APR zip file
function unZipItAPR(fo,na) {
  var theFolder = DriveApp.getFolderById(fo); // folder with zipped report
  var theFile = theFolder.getFilesByName(na); // gets the contents of the zip file
  var fileBlob = theFile.next().getBlob(); // stores the files for processing
  fileBlob.setContentType("application/zip"); //sets the correct file type for the zip file
  var unZippedFiles = Utilities.unzip(fileBlob);

  // unzips the files into the folder
  for (var i in unZippedFiles) {
  if (unZippedFiles(i).getName() != 'Q4a.csv' 
      && unZippedFiles(i).getName() != 'Q6e.csv'
      && unZippedFiles(i).getName() != 'Q6f.csv'
      && unZippedFiles(i).getName() != 'Q7b.csv'
      && unZippedFiles(i).getName() != 'Q8b.csv'
      && unZippedFiles(i).getName() != 'Q9a.csv'
      && unZippedFiles(i).getName() != 'Q9b.csv') {
    var newDriveFile = DriveApp.createFile(unZippedFiles(i));
    var zipFile = newDriveFile.getId();
    theFolder.addFile(DriveApp.getFileById(zipFile));
    DriveApp.removeFile(DriveApp.getFileById(zipFile));
    }
  }
  // removes file after it has been unzipped
  DriveApp.getFilesByName(na).next().setTrashed(true);
};

// unzips CSV zip file
function unZipItCSV(fo,na) {
  var theFolder = DriveApp.getFolderById(fo); // folder with zipped report
  var theFile = theFolder.getFilesByName(na); // gets the contents of the zip file
  var fileBlob = theFile.next().getBlob(); // stores the files for processing
  fileBlob.setContentType("application/zip"); // sets the correct file type for the zip file
  var unZippedFiles = Utilities.unzip(fileBlob);

  // unzips the files into the folder
  for (var i in unZippedFiles) {
  var csvZipName = unZippedFiles(i).getName();
  if (csvZipName == 'Client.csv'
      || csvZipName == 'Enrollment.csv'
      || csvZipName == 'Exit.csv'
      || csvZipName == 'HealthAndDV.csv'
      || csvZipName == 'Project.csv') {
    var newDriveFile = DriveApp.createFile(unZippedFiles(i));
    var zipFile = newDriveFile.getId();
    theFolder.addFile(DriveApp.getFileById(zipFile));
    DriveApp.removeFile(DriveApp.getFileById(zipFile));
    }
  }
  // removes file after it has been unzipped
  DriveApp.getFilesByName(na).next().setTrashed(true);
};

// imports files into data spreadsheet
function importFile(fiName,foId,spId) {
  var fSource = DriveApp.getFolderById(foId); // folder where csv files are saved
  var fi = fSource.getFilesByName(fiName); // latest report file
  var ss = SpreadsheetApp.openById(spId); // data_sheet_id = id of spreadsheet that holds the data to be updated with new report data

  if ( fi.hasNext() ) { // proceed if csv file exists in the folder
    var file = fi.next();
    var csv = file.getBlob().getDataAsString();
    var csvData = CSVToArray(csv); // see below for CSVToArray function

    // removes the extension from file name
    var fiNameShort = fiName.split('.').slice(0, -1).join('.');

    var sheet = ss.getSheetByName(fiNameShort);

    // loop through csv data array and insert (append) as rows into 'DATA' sheet
    for ( var i=0, lenCsv=csvData.length; i```

SQL Server 2016 – Optimize XOR search in the int list

I have a large table (TableA) with about 120 million. Records. This table contains a single primary key column (type: int).

Another large table (Table B) contains the same ID column with some other fields. There is currently no foreign key restriction or unique index defined in this table (although I definitely want to consider adding a primary key restriction here).

The main task is to determine whether one of the ID values ​​in Table A is NOT shown in Table B.

SELECT * FROM TableA WHERE Id NOT IN (SELECT Id FROM TableB)  

I have this task on our database server for about 4 minutes. Now I wondered if there was a way to improve it. As far as I know, the lists may not be orderable, BUT it is guaranteed that the ID is unique for both tables. Is there a method I can use to sort these fields first (or better still have a sorted index) and then simply compare those sorted lists, or is there another approach to this?

Performance – Optimize the execution speed of Python

Hello, I recently wrote code in Python that does the following:

1.) Draws closing data from Yahoo Finance for x number of shares

2.) finds all possible combinations of x shares in groups of y size (i.e. all combinations of 13 shares in groups of 10)

3.) apply some calculations to each of these groups

4.) returns the optimal weights of each group. (Weights mean what percentage of the money should and must be invested in each share = 100%)

5.) Creates a data frame with all optimal portfolio weights (group weights)

My code works, but it is slow. Each loop on my PC takes an average of 2.45 seconds. This is fine for a small number of permutations as in the example above, but as the number of selections increases, so does the number of options. For example, a list of 30 stocks listed in unique groups of 15 has 155117520 ways my code would take over 12 years ….. I'm just looking for suggestions or instructions to speed up the execution of my code improve. I'm relatively new to coding, but I'm aware that Python is slower than other languages ​​in this task. At the moment, however, I only know a few Python basics. I'm using some for loops in this code that I know are slow, and instead I'm looking at using .apply () if you could help in any way it would be desirable.

import pandas as pd
from pandas_datareader import data
import datetime
import numpy as np
import random
import itertools
import requests
import time

time1 = time.time()


start = datetime.datetime(2015, 1, 1)

end = datetime.datetime(2019, 12, 31)

list2 = ()

num = ()


#################SP Download#######################

sptickers1 = ('MMM', 'ABT', 'ABBV', 'ABMD', 'ACN', 'ATVI', 'ADBE', 'AMD', 'AAP', 'AES', 'AFL', 'A', 'APD', 'AKAM', 'ALK', 'ALB', 'ARE', 'ALXN', 'ALGN', 'ALLE', 'AGN', 'ADS', 'LNT', 'ALL', 'GOOGL', 'GOOG', 'MO', 'AMZN', 'AMCR', 'AEE', 'AAL', 'AEP', 'AXP', 'AIG', 'T', 'AMT', 'AWK', 'AMP', 'ABC', 'AME', 'AMGN', 'APH', 'ADI', 'ANSS', 'ANTM', 'AON', 'AOS', 'APA', 'AIV', 'AAPL', 'AMAT', 'APTV', 'ADM', 'ARNC', 'ANET', 'AJG', 'AIZ', 'ATO', 'ADSK', 'ADP', 'AZO', 'AVB', 'AVY', 'BKR', 'BLL', 'BAC', 'BK', 'BAX', 'BDX', 'BBY', 'BIIB', 'BLK', 'BA', 'BKNG', 'BWA', 'BXP', 'BSX', 'BMY', 'AVGO', 'BR', 'CHRW', 'COG', 'CDNS', 'CPB', 'COF', 'CPRI', 'CAH', 'KMX', 'CCL', 'CAT', 'CBOE', 'CBRE', 'CDW', 'CE', 'CNC', 'CNP', 'CTL', 'CERN', 'CF', 'SCHW', 'CHTR', 'CVX', 'CMG', 'CB', 'CHD', 'CI', 'CINF', 'CTAS', 'CSCO', 'C', 'CFG', 'CTXS', 'CLX', 'CME', 'CMS', 'KO', 'CTSH', 'CL', 'CMCSA', 'CMA', 'CAG', 'CXO', 'COP', 'ED', 'STZ', 'COO', 'CPRT', 'GLW', 'CTVA', 'COST', 'COTY', 'CCI', 'CSX', 'CMI', 'CVS', 'DHI', 'DHR', 'DRI', 'DVA', 'DE', 'DAL', 'XRAY', 'DVN', 'FANG', 'DLR', 'DFS', 'DISCA', 'DISCK', 'DISH', 'DG', 'DLTR', 'D', 'DOV', 'DOW', 'DTE', 'DUK', 'DRE', 'DD', 'DXC', 'ETFC', 'EMN', 'ETN', 'EBAY', 'ECL', 'EIX', 'EW', 'EA', 'EMR', 'ETR', 'EOG', 'EFX', 'EQIX', 'EQR', 'ESS', 'EL', 'EVRG', 'ES', 'RE', 'EXC', 'EXPE', 'EXPD', 'EXR', 'XOM', 'FFIV', 'FB', 'FAST', 'FRT', 'FDX', 'FIS', 'FITB', 'FE', 'FRC', 'FISV', 'FLT', 'FLIR', 'FLS', 'FMC', 'F', 'FTNT', 'FTV', 'FBHS', 'FOXA', 'FOX', 'BEN', 'FCX', 'GPS', 'GRMN', 'IT', 'GD', 'GE', 'GIS', 'GM', 'GPC', 'GILD', 'GL', 'GPN', 'GS', 'GWW', 'HRB', 'HAL', 'HBI', 'HOG', 'HIG', 'HAS', 'HCA', 'PEAK', 'HP', 'HSIC', 'HSY', 'HES', 'HPE', 'HLT', 'HFC', 'HOLX', 'HD', 'HON', 'HRL', 'HST', 'HPQ', 'HUM', 'HBAN', 'HII', 'IEX', 'IDXX', 'INFO', 'ITW', 'ILMN', 'INCY', 'IR', 'INTC', 'ICE', 'IBM', 'IP', 'IPG', 'IFF', 'INTU', 'ISRG', 'IVZ', 'IPGP', 'IQV', 'IRM', 'JKHY', 'J', 'JBHT', 'SJM', 'JNJ', 'JCI', 'JPM', 'JNPR', 'KSU', 'K', 'KEY', 'KEYS', 'KMB', 'KIM', 'KMI', 'KLAC', 'KSS', 'KHC', 'KR', 'LB', 'LHX', 'LH', 'LRCX', 'LW', 'LVS', 'LEG', 'LDOS', 'LEN', 'LLY', 'LNC', 'LIN', 'LYV', 'LKQ', 'LMT', 'L', 'LOW', 'LYB', 'MTB', 'M', 'MRO', 'MPC', 'MKTX', 'MAR', 'MMC', 'MLM', 'MAS', 'MA', 'MKC', 'MXIM', 'MCD', 'MCK', 'MDT', 'MRK', 'MET', 'MTD', 'MGM', 'MCHP', 'MU', 'MSFT', 'MAA', 'MHK', 'TAP', 'MDLZ', 'MNST', 'MCO', 'MS', 'MOS', 'MSI', 'MSCI', 'MYL', 'NDAQ', 'NOV', 'NTAP', 'NFLX', 'NWL', 'NEM', 'NWSA', 'NWS', 'NEE', 'NLSN', 'NKE', 'NI', 'NBL', 'JWN', 'NSC', 'NTRS', 'NOC', 'NLOK', 'NCLH', 'NRG', 'NUE', 'NVDA', 'NVR', 'ORLY', 'OXY', 'ODFL', 'OMC', 'OKE', 'ORCL', 'PCAR', 'PKG', 'PH', 'PAYX', 'PAYC', 'PYPL', 'PNR', 'PBCT', 'PEP', 'PKI', 'PRGO', 'PFE', 'PM', 'PSX', 'PNW', 'PXD', 'PNC', 'PPG', 'PPL', 'PFG', 'PG', 'PGR', 'PLD', 'PRU', 'PEG', 'PSA', 'PHM', 'PVH', 'QRVO', 'PWR', 'QCOM', 'DGX', 'RL', 'RJF', 'RTN', 'O', 'REG', 'REGN', 'RF', 'RSG', 'RMD', 'RHI', 'ROK', 'ROL', 'ROP', 'ROST', 'RCL', 'SPGI', 'CRM', 'SBAC', 'SLB', 'STX', 'SEE', 'SRE', 'NOW', 'SHW', 'SPG', 'SWKS', 'SLG', 'SNA', 'SO', 'LUV', 'SWK', 'SBUX', 'STT', 'STE', 'SYK', 'SIVB', 'SYF', 'SNPS', 'SYY', 'TMUS', 'TROW', 'TTWO', 'TPR', 'TGT', 'TEL', 'FTI', 'TFX', 'TXN', 'TXT', 'TMO', 'TIF', 'TJX', 'TSCO', 'TT', 'TDG', 'TRV', 'TFC', 'TWTR', 'TSN', 'UDR', 'ULTA', 'USB', 'UAA', 'UA', 'UNP', 'UAL', 'UNH', 'UPS', 'URI', 'UTX', 'UHS', 'UNM', 'VFC', 'VLO', 'VAR', 'VTR', 'VRSN', 'VRSK', 'VZ', 'VRTX', 'V', 'VNO', 'VMC', 'WRB', 'WAB', 'WMT', 'WBA', 'DIS', 'WM', 'WAT', 'WEC', 'WFC', 'WELL', 'WDC', 'WU', 'WRK', 'WY', 'WHR', 'WMB', 'WLTW', 'WYNN', 'XEL', 'XRX', 'XLNX', 'XYL', 'YUM', 'ZBRA', 'ZBH', 'ZION', 'ZTS')

dstocks = sptickers1(0:13)

df = data.DataReader(dstocks, 'yahoo', start, end)('Close')

combinations = list(itertools.combinations(dstocks, 10))

combinationslist = ()

for i in combinations:
    combinationslist.append(list(i))

for i in combinationslist:
    try:

        start_time = time.time()

        df1 = df(i).copy()

        dfpct = df1.pct_change().apply(lambda x: np.log(x+1))

        sdd = dfpct.std()

        sda = sdd.apply(lambda x: x*np.sqrt(250))

        var = dfpct.var()




        cov_matrix = dfpct.cov()


        dfer = df1.resample('Y').last().pct_change()

        er = dfer.mean()



        p_ret = ()
        p_vol = ()
        p_weights = ()
        num_p = 1000



        for portfolio in range(num_p):
            n = len(i)
            weights = (random.random() for e in range(n))
            sum_weights = sum(weights)
            weights = (w/sum_weights for w in weights)
            p_weights.append(weights)
            returns = np.dot(weights, er)
            p_ret.append(returns)
            p_var = cov_matrix.mul(weights, axis = 0).mul(weights, axis=1).sum().sum()
            p_sd = np.sqrt(p_var)
            p_sda = p_sd*np.sqrt(250)
            p_vol.append(p_sda)



        data = {'Returns':p_ret, 'Volatility':p_vol}



        for counter, symbol in enumerate(dfpct.columns.tolist()):
            data(symbol+ ' Weight') = (w(counter) for w in p_weights)



        portfolios = pd.DataFrame(data)



        rf = 0.02

        optimaln = ((portfolios('Returns')-rf)/portfolios('Volatility')).idxmax()

        optimal = portfolios.loc(optimaln)

        optimal1 = pd.DataFrame(optimal).transpose()


        optimal1I = optimal1.index.tolist()

        dictoptimal = portfolios.loc(optimal1I).to_dict(orient='records')

        list2.append(dictoptimal)

        end_time = time.time()

        print("total time taken this loop: ", end_time - start_time)


    except:
        print('Didnt work')
        num.append('didnt work')
        continue

print(len(num))




fin = pd.DataFrame.from_dict(list2)



time2 = time.time()


print('program took ' + str(time2-time1) + ' Seconds')

```

I'll optimize your YouTube video SEO-friendly for $ 30

I will optimize your YouTube video SEO friendly

YouTube Video Seo / Optimization / Seo / Ranking / Promotion

Respected customers Welcome to my gig.
I will optimize and improve your YouTube videos with the SEO expert technique. This puts your video in first place in the search on the first page. With a clear title, strong description and high-volume tags, your videos get more views and more subscribers.

Guaranteed optimizations in: –
Clearly searched title
Strong and effective description
High volume tags
Custom HD thumbnails (attract more viewers) Standard and Premium package only
Add end screen
Add maps to the video (links to your websites, videos, or playlists)
Channel Seo and Channel Tags (increase the ranking of the channel search) Standard and Premium package only
And much more according to customer requirements

Thank you very much.

(NOTE: – You have problems with please contact me before placing your order.)

(tagsToTranslate) Seo (t) Youtube (t) Tanking (t) Views (t) Analysis