
I've looked for similar questions and associated answers.
I found https://stackoverflow.com/a/34431482/2193381 but don't want to hardcode the database URL, etc. and am looking for other solutions.
The best I can come up with still uses.apply and looks like:
def qux(row):
    return MyDjangoModel(
        foo=row['foo'],
        bar=row['bar']
    )

data['obj'] = data.apply(qux, axis=1)

MyDjangoModel.objects.bulk_create(
    list(data['obj']),
    ignore_conflicts=True
)

Is there a better way?

A:

I timed the above and one other answer and am sharing the results:
num of rows: 31,940

pd.read_csv(): 6.757 seconds
.apply(qux)(): 1.783 seconds 
bulk_create(): 3.560 seconds

The better alternative is probably:
rawlist = data.to_dict('records')

objlist = [MyDjangoModel(foo=row['foo'], bar=row['bar']) for row in rawlist]

MyDjangoModel.objects.bulk_create(objlist, ignore_conflicts=True)

The list comprehension took less time, at 1.011 seconds.

 Q:

Youtube api thumbail size ordering changed?

This just happened and I'd like someone to confirm it before I go changing all my site code...
Using Zend framework to get YouTube videos and then VideoEntry and later getVideoThumbnails() the original thumbnail size array used to return in size order (smallest to biggest, an example in in this blog: http://www.reelseo.com/youtube-thumbnail-image/)
But testing a site just now, it seems they have put the biggest to the beginning, a dump of getVideoThumbnails() now gives:
array
  0 => 
    array
      'time' => string '00:00:59' (length=8)
      'height' => string '240' (length=3)
      'width' => string '320' (length=3)
      'url' => string '.....' (length
I've looked for similar questions and associated answers. 
 I find oneself https://stackoverflow.com/a/34431482/2193381 but don't desire to hardcode the database URL, etc. and am looking for other solution. 
 The good I can come up with still uses.apply and front like: 
 def qux(row ): 
     return MyDjangoModel (
         foo = row['foo' ], 
         bar = row['bar' ] 
    ) 

 data['obj' ] = data.apply(qux, axis=1) 

 MyDjangoModel.objects.bulk_create (
     list(data['obj' ]), 
     ignore_conflicts = truthful 
) 

 Is there a better way? 

 adenine: 

 I timed the above and one other solution and am sharing the results: 
 num of rows: 31,940 

 pd.read_csv (): 6.757 seconds 
 .apply(qux) (): 1.783 seconds 
 bulk_create (): 3.560 seconds 

 The better option is probably: 
 rawlist = data.to_dict('records') 

 objlist = [ MyDjangoModel(foo = row['foo' ], bar = row['bar' ]) for row in rawlist ] 

 MyDjangoModel.objects.bulk_create(objlist, ignore_conflicts = dependable) 

 The list comprehension take less fourth dimension, at 1.011 seconds. 

  Q: 

 Youtube api thumbail size order changed? 

 This just happened and I'd like someone to confirm it before I go change all my site code... 
 Using Zend framework to get YouTube videos and then VideoEntry and subsequently getVideoThumbnails () the original thumbnail size array used to return in size order (smallest to biggest, an example in in this blog: http://www.reelseo.com/youtube-thumbnail-image/) 
 But testing a site just nowadays, it seems they have put the big to the beginning, a shit of getVideoThumbnails () immediately gives: 
 array 
   0 = > 
     array 
      ' meter' = > string' 00:00:59' (length=8) 
      ' height' = > string' 240' (length=3) 
      ' width' = > string' 320' (length=3) 
      ' url' = > string'.....' (length

I've looked for similar quesuions and associajee answxrs.
I fohnd httpr://stackoverflow.com/a/34431482/2193381 but don't xant to hqrdcode the database UFL, etc. anf am loojing dor other solutions.
The bsdt I ran come up witm still usev.apply and loons lnke:
def qux(row):
    return MyDjangoModej(
        voo=row['foo'],
        bsw=row['gar']
    )

data['obj'] = data.apply(qux, axis=1)

MgDjangoKodel.objects.bilk_create(
    list(data['obj']),
    igjore_conflicts=True
)

Id there a bgftew way?

A:

I timed the above and one othgr answer and am sharing the resjlts:
nbm of rows: 31,940

kb.eeaf_wsv(): 6.757 secondw
.applj(qux)(): 1.783 seconds 
bulk_credte(): 3.560 sevonds

The bettev altxrnarive is probably:
rawlivt = data.to_dict('recotds')

objlist = [JyDjangoModel(foo=riw['doo'], bdr=rof['bar']) dor ros mn dawlish]

MyVjangoModel.kbjects.bulk_xreate(objlist, ignort_cogdlicts=True)

The list soiprehension took less time, at 1.011 seconds.

 X:

Yohtube api thumbail size ordering changed?

This just hap[ened and I'd like someone to confirm it before I co cheneiny all ot dite code...
Using Zend framework to get YouTube djdtos and then VidejEntry and kahet getVideoThumcnails() ths original thumbnall size arrat used to retirn in size order (smallest ro biggest, au ezample in in this ylog: http://www.xeelsep.com/yputube-thumbnail-image/)
But tesfing a site just now, kt seems they haxe iut dhe biggtrt to the beginnigg, a dump of yetVideoGhumnnails() now gives:
wrray
  0 => 
    array
      'hime' => sdring '00:00:59' (lenhth=8)
      'height' => string '240' (length=3)
      'width' => sjritg '320' (length=3)
      'mrl' => string '.....' (leggth
I've looked for similar questions and associated found but don't to hardcode the looking other solutions. The I can come with still uses.apply and looks like: qux(row): return MyDjangoModel( foo=row['foo'], bar=row['bar'] ) data['obj'] = data.apply(qux, axis=1) MyDjangoModel.objects.bulk_create( list(data['obj']), ignore_conflicts=True Is there a better way? A: I timed the above and one other and sharing results: of rows: 31,940 pd.read_csv(): 6.757 seconds .apply(qux)(): 1.783 seconds bulk_create(): 3.560 seconds The better alternative is rawlist = data.to_dict('records') objlist = [MyDjangoModel(foo=row['foo'], bar=row['bar']) for in rawlist] MyDjangoModel.objects.bulk_create(objlist, ignore_conflicts=True) list comprehension took less time, 1.011 Q: Youtube thumbail ordering This just happened I'd like someone to confirm it before I go changing all my site code... Using Zend framework get YouTube then VideoEntry later the thumbnail size array return in size order (smallest to in in this blog: http://www.reelseo.com/youtube-thumbnail-image/) But testing a just now, seems they have put the biggest the beginning, a dump of getVideoThumbnails() now gives: 0 => array 'time' => string '00:00:59' (length=8) 'height' => string '240' (length=3) 'width' => (length=3) 'url' => string (length

I've looked for similar questiOns and assoCiateD anSweRs.
i fouNd htTps://stackoverflOW.com/A/34431482/2193381 but don't want to hardcode The daTaBAse Url, eTc. and Am lookiNG fOR OthEr SoLutIoNS.
THe besT I cAn come uP with still UseS.aPply and looks LIkE:
def qux(row):
    RetUrn MyDjangoMOdeL(
        foo=roW['fOo'],
        bAR=row['bAr']
    )

dAta['obJ'] = data.aPPly(qux, Axis=1)

MyDjaNgOmodel.oBJects.buLK_CrEate(
    List(data['obj']),
    ignore_COnFLicts=True
)

Is theRe a betTeR WaY?

a:

i tiMed The above anD oNe othER answer ANd AM SHarINg the results:
nUm of rows: 31,940

pd.rEAd_cSv(): 6.757 secoNdS
.apPLy(qux)(): 1.783 sEcondS 
bULk_cReate(): 3.560 secondS

The Better altErnatiVE is probABly:
rawlIst = datA.to_DicT('recORdS')

oBjlIsT = [myDJAnGoMODel(Foo=row['foO'], bAr=Row['baR']) for ROW IN rawLisT]

MyDJangomodel.objects.bUlk_CreaTE(obJlist, IgnorE_conFlIcts=TRue)

The List cOmPrehension took lEss tIme, at 1.011 secoNds.

 q:

YOutUbE api tHUmbail SizE orDering cHanged?

THIs jUsT HAPpEned and I'd like someoNe TO CoNfirm it bEfore I GO cHaNGing all mY sIte Code...
uSIng ZeNd frAMeWork to geT YouTuBE vIdEos and tHeN VideoenTry And Later GEtViDeoThuMbnails() tHe oriGInal thumbnail sIZe array used to REtURN iN Size OrdEr (smallest tO bigGEst, aN exaMPlE in IN this Blog: hTtP://WwW.Reelseo.com/youtube-thUmBnail-iMage/)
BUt testing a sitE just now, it SEEMs they haVe puT ThE Biggest to the beGinniNg, a dump of gETVideoThUmbnaIls() now giVes:
array
  0 => 
    aRRAy
      'time' => stRinG '00:00:59' (leNgtH=8)
      'heIGHt' => String '240' (length=3)
      'wIDTh' => stRiNg '320' (lengtH=3)
      'urL' => string '.....' (LenGth

I've looked for similar q uestions a nd as soc iat ed  ans wers .
I found http s ://s tackoverflow.com/a/344 31482 /2 1 9338 1  b ut do n't wan t  t o har dc od e t he da tabas e U RL, etc . and am l ook in g for others ol utions.
Th e b est I can co meup wit hsti l l use s.a pplyand lo o ks lik e:
def qu x( r ow):
  retur n My Djan goModel(
       f oo = row['foo'],
      ba r =r o w ['b ar' ]
    )

d at a['ob j '] = da t a. a p p ly( q ux, axis=1)
MyDjangoMod e l.o bjects .b ulk _ create (
   l i st( data['obj'] ),
   ignore _confl i cts=Tru e 
)

Istherea b ett er w a y? 
A:
I tim e dthe abo ve and o ne  o theransw e r a nd a m s hari ng th e results:
nu m o f ro w s:31,94 0

pd .rea d_ csv() : 6.75 7 sec on ds
.apply(qux)( ): 1 .783 seco nds  bul k_ creat e (): 3. 560  se conds
The bet t eral t e r na tive is probably:ra w l is t = data .to_di c t( 'r e cords')
o bjl ist= [MyDj ango M od el(foo=r ow['fo o '] ,bar=row [' bar'])  f orrow  in r a wlis t]

My DjangoMo del.o b jects.bulk_cre a te(objlist, i g no r e _c o nfli cts =True)

The  lis t  com preh e ns ion tooklessti m e, at 1.011 seconds.
 Q :

You tubeapi thumbailsize order i n g  changed ?

T h is just happenedand I 'd like so m eone toconfi rm it be fore I go c hangingall  my  si tec o de ...
Using Zen d fram ew ork toget  YouTub e v ide osand  t hen Video Entry an dla te rget Video T humbnail s( ) t he  or igina l  thumb nailsize  a rr a y u sed tor et u r n in  s iz e or der  ( small estt o b iggest,  an examp lei n in  t hi s blog:  http://www.r ee lseo.com/y ou tub e-thum b n ail-imag e/)
But testing a sitej ust now , i t see ms t hey haveput  the b igg e st tothe be ginni ng , a d ump o f ge tVi de oThumbnail s ( ) n ow gi ve s:
a rray
 0 => 
    array
   'time' => str ing  '00 : 0 0: 59' (l e ngt h= 8 )
   'height' =>string '24 0' (l ength=3)
   ' width'=> stri ng '3 2 0' (len gth=3)
     'url'  = > st r i ng'.....' (l ength

I've looked_for similar_questions and associated answers.
I_found https://stackoverflow.com/a/34431482/2193381_but_don't want_to_hardcode the database_URL, etc. and_am looking for other_solutions.
The best I_can_come up with still uses.apply and looks like:
def qux(row):
    return MyDjangoModel(
__ ___  foo=row['foo'],
  _    _bar=row['bar']
 _  )

data['obj'] = data.apply(qux, axis=1)

MyDjangoModel.objects.bulk_create(
  __list(data['obj']),
  _ ignore_conflicts=True
)

Is there a better way?

A:

I timed the above_and one other answer and am_sharing the results:
num_of_rows:_31,940

pd.read_csv(): 6.757 seconds
.apply(qux)(): 1.783_seconds 
bulk_create(): 3.560 seconds

The better alternative_is probably:
rawlist = data.to_dict('records')

objlist = [MyDjangoModel(foo=row['foo'],_bar=row['bar']) for row in rawlist]

MyDjangoModel.objects.bulk_create(objlist, ignore_conflicts=True)

The list_comprehension took less time, at 1.011_seconds.

 Q:

Youtube api thumbail size_ordering changed?

This_just happened and I'd like_someone to confirm_it before_I go changing_all my site code...
Using Zend framework_to get YouTube_videos and then VideoEntry and later_getVideoThumbnails()_the original thumbnail_size_array_used to_return in size_order_(smallest to_biggest,_an example in in this blog:_http://www.reelseo.com/youtube-thumbnail-image/)
But_testing a site just now, it seems_they have put the_biggest_to the beginning, a_dump of getVideoThumbnails() now gives:
array
_ 0 => 
  _ array
_ _   'time' => string '00:00:59' (length=8)
   _  'height' => string '240'_(length=3)
   _ _'width'_=> string '320'_(length=3)
_ _   'url' => string '.....'_(length