-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpytip.csv
We can't make this file beautiful and searchable because it's too large.
6603 lines (4935 loc) · 528 KB
/
pytip.csv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
id,created_at,favorite_count,retweet_count,full_text,is_reply,is_retweet,url,urls,media
1325839863309078529,2020-11-09 16:37:10+00:00,41,8,"`split-folders` package makes it easy to split images in the input folder into train, validation and test folders:
>>> import splitfolders
>>> splitfolders.ratio(""input_folder"", output=""output"", seed=1337, ratio=(.8, .1, .1)
https://t.co/wTAwQFAIOK https://t.co/ALPBNnwfUJ",False,False,https://twitter.com/python_tip/status/1325839863309078529,"[{'url': 'https://t.co/wTAwQFAIOK', 'expanded_url': 'https://pypi.org/project/split-folders/', 'display_url': 'pypi.org/project/split-…'}]","[{'url': 'https://t.co/ALPBNnwfUJ', 'media_url': 'http://pbs.twimg.com/media/EmZUPyKW8AIIUbj.png', 'display_url': 'pic.twitter.com/ALPBNnwfUJ'}]"
1324436571920101376,2020-11-05 19:41:00+00:00,81,26,"Read multiple csv from a zip file:
from zipfile import ZipFile
import pandas as pd
zf = ZipFile(""z_f.zip"")
df_lst = [https://t.co/KBWVZb2pZj_csv(https://t.co/8dJA0i8dng(fle.filename)) for fle in zf.infolist() if fle.filename.endswith("".csv"")]
tip by @PetraVidnerova #Pandas",False,False,https://twitter.com/python_tip/status/1324436571920101376,"[{'url': 'https://t.co/KBWVZb2pZj', 'expanded_url': 'http://pd.read', 'display_url': 'pd.read'}]",[]
1324205046154735621,2020-11-05 04:21:00+00:00,94,18,"#pandas DataFrame.explode() will transform each element of a list-like to a row
df = pd.DataFrame([{'var1': ['a', 'b', 'c', 'd'], 'var2': 1}, {'var1': ('x', 'y'), 'var2': 3}])
df.explode('var1')
https://t.co/lBalG6xeBl https://t.co/cmX791nW6I",False,False,https://twitter.com/python_tip/status/1324205046154735621,"[{'url': 'https://t.co/lBalG6xeBl', 'expanded_url': 'https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.explode.html', 'display_url': 'pandas.pydata.org/pandas-docs/st…'}]","[{'url': 'https://t.co/cmX791nW6I', 'media_url': 'http://pbs.twimg.com/media/EmAgzicXgAEe7J7.jpg', 'display_url': 'pic.twitter.com/cmX791nW6I'}]"
1324090855741902849,2020-11-04 20:47:15+00:00,73,13,"In #Python3, the print function has options
* 'sep' to separate the arguments
* 'end' to be printed after the last argument
>>> lst = ['a', 'b', 'c']
>>> print(*lst)
a b c
>>> print(*lst, sep=', ', end='!!!\n')
a, b, c!!!
https://t.co/Jm8LgioMJb",False,False,https://twitter.com/python_tip/status/1324090855741902849,"[{'url': 'https://t.co/Jm8LgioMJb', 'expanded_url': 'https://docs.python.org/3/library/functions.html#print', 'display_url': 'docs.python.org/3/library/func…'}]",[]
1323402107010121728,2020-11-02 23:10:24+00:00,12,7,"PyData Global: fully virtual event
Nov 11th-15th
talks, tutorials, posters and sprints
tickets are sold under a pay-what-you-can pricing model
https://t.co/rw4XQKuRqq
#Python #PyDataGlobal2020 #pydata",False,False,https://twitter.com/python_tip/status/1323402107010121728,"[{'url': 'https://t.co/rw4XQKuRqq', 'expanded_url': 'https://global.pydata.org/', 'display_url': 'global.pydata.org'}]",[]
1322073500891275267,2020-10-30 07:11:00+00:00,34,9,"I Like Notebooks
@jeremyphoward's recent talk about Jupyter notebooks, also #nbdev and #fastdoc
https://t.co/srMIchVD7p",False,False,https://twitter.com/python_tip/status/1322073500891275267,"[{'url': 'https://t.co/srMIchVD7p', 'expanded_url': 'https://www.youtube.com/watch?v=9Q6sLbz37gk', 'display_url': 'youtube.com/watch?v=9Q6sLb…'}]",[]
1321975163752206338,2020-10-30 00:40:14+00:00,28,6,"Python can handle complex numbers
>>> import cmath
>>>
>>> x,y = 5,1
>>> z = complex(x,y)
>>>
>>> z.real, z.imag
(5.0, 1.0)
>>> z
(5+1j)
>>>
>>> w = cmath.polar(z)
>>> w
(5.0990195135927845, 0.19739555984988075) https://t.co/ZVjmm7IBln",False,False,https://twitter.com/python_tip/status/1321975163752206338,"[{'url': 'https://t.co/ZVjmm7IBln', 'expanded_url': 'https://twitter.com/SciPyTip/status/1321926042634850304', 'display_url': 'twitter.com/SciPyTip/statu…'}]",[]
1321766750682230785,2020-10-29 10:52:05+00:00,35,5,"Generate a summary of your dataset with `pandas_profiling` package
>>> import pandas_profiling
>>> df.profile_report()
https://t.co/SBGJd5pmwj https://t.co/R4d6obwMeG",False,False,https://twitter.com/python_tip/status/1321766750682230785,"[{'url': 'https://t.co/SBGJd5pmwj', 'expanded_url': 'https://www.kaggle.com/python10pm/pandas-100-tricks#Trick-34:-Explore-a-dataset-with-profiling', 'display_url': 'kaggle.com/python10pm/pan…'}]","[{'url': 'https://t.co/R4d6obwMeG', 'media_url': 'http://pbs.twimg.com/media/ElfbvgdXIAIDLzS.png', 'display_url': 'pic.twitter.com/R4d6obwMeG'}]"
1321246292916555778,2020-10-28 00:23:58+00:00,60,7,#pythontip by @NurmeAve about cycling through the list of players https://t.co/BoWLNoeRni,False,False,https://twitter.com/python_tip/status/1321246292916555778,[],"[{'url': 'https://t.co/BoWLNoeRni', 'media_url': 'http://pbs.twimg.com/media/ElYCYpOXgAEJbLT.png', 'display_url': 'pic.twitter.com/BoWLNoeRni'}]"
1321007704891162624,2020-10-27 08:35:54+00:00,30,5,"Do you need to rename an attribute of a class, a method, a function's keyword...? `Rope` can help you with that
https://t.co/fdXjwhz5Z5
Or you can refactor with VS Code
https://t.co/J7AJehPTwe",False,False,https://twitter.com/python_tip/status/1321007704891162624,"[{'url': 'https://t.co/fdXjwhz5Z5', 'expanded_url': 'https://github.com/python-rope/rope/blob/master/docs/overview.rst', 'display_url': 'github.com/python-rope/ro…'}, {'url': 'https://t.co/J7AJehPTwe', 'expanded_url': 'https://code.visualstudio.com/docs/python/editing#_refactoring', 'display_url': 'code.visualstudio.com/docs/python/ed…'}]",[]
1319825437933981696,2020-10-24 02:18:00+00:00,80,12,">>> from datetime import date
>>> somedate = date(2020, 12, 25)
>>> (somedate - https://t.co/DAMy3fUkMd()).days
63",False,False,https://twitter.com/python_tip/status/1319825437933981696,"[{'url': 'https://t.co/DAMy3fUkMd', 'expanded_url': 'http://date.today', 'display_url': 'date.today'}]",[]
1319726408957046784,2020-10-23 19:44:29+00:00,95,17,">>> lst = ['alice', 'bob', 'charlie']
>>> print(', '.join(lst))
alice, bob, charlie
>>> print(*lst, sep=', ')
alice, bob, charlie
#python",False,False,https://twitter.com/python_tip/status/1319726408957046784,[],[]
1318758155166404608,2020-10-21 03:37:00+00:00,20,3,"#pandas
Int64 - nullable integer type
>>> pd.Series([1, 2, np.nan, None, https://t.co/kKksLTtTy3], dtype=""Int64"")
0 1
1 2
2 <NA>
3 <NA>
4 <NA>
dtype: Int64
>>> pd.Series([1, np.nan, None, https://t.co/kKksLTtTy3], dtype=""int64"")
☠️
https://t.co/ZQ211K5Kpc",False,False,https://twitter.com/python_tip/status/1318758155166404608,"[{'url': 'https://t.co/kKksLTtTy3', 'expanded_url': 'http://pd.NA', 'display_url': 'pd.NA'}, {'url': 'https://t.co/kKksLTtTy3', 'expanded_url': 'http://pd.NA', 'display_url': 'pd.NA'}, {'url': 'https://t.co/ZQ211K5Kpc', 'expanded_url': 'https://pandas.pydata.org/pandas-docs/stable/user_guide/integer_na.html', 'display_url': 'pandas.pydata.org/pandas-docs/st…'}]",[]
1318662854606790674,2020-10-20 21:18:18+00:00,2,0,"@starenka @LSC_David_Isaac yep
>>> txt.strip('_a') # remove all _ and a's from the ends
'python'
>>> txt.rstrip('_a')
'aaa_python'
>>> txt.removesuffix('_a') # suffix not found
'aaa_python_aaa_aaa'
>>> txt.removeprefix(""_a"")
'aaa_python_aaa_aaa'",True,False,https://twitter.com/python_tip/status/1318662854606790674,[],[]
1318629978376896514,2020-10-20 19:07:40+00:00,42,11,"New in #python3.9
str.removeprefix()
str.removesuffix()
>>> txt = 'aaa_python_aaa_aaa'
>>> txt.removesuffix('_aaa')
'aaa_python_aaa'
compare:
>>> txt.rstrip('_a')
'aaa_python'
https://t.co/KTfoRSIpEA",False,False,https://twitter.com/python_tip/status/1318629978376896514,"[{'url': 'https://t.co/KTfoRSIpEA', 'expanded_url': 'https://www.python.org/dev/peps/pep-0616/', 'display_url': 'python.org/dev/peps/pep-0…'}]",[]
1317761337007632384,2020-10-18 09:36:00+00:00,125,20,Identify language of a document with pycld2 package: https://t.co/7bdB2ONteQ,False,False,https://twitter.com/python_tip/status/1317761337007632384,[],"[{'url': 'https://t.co/7bdB2ONteQ', 'media_url': 'http://pbs.twimg.com/media/EkhS5W0W0AEz6Yt.jpg', 'display_url': 'pic.twitter.com/7bdB2ONteQ'}]"
1317385160350892032,2020-10-17 08:41:12+00:00,119,24,"With #pandas DataFrame.explode you can transform list-like element into a row, replicating index values.
Example: https://t.co/5Jfpfgahjf",False,False,https://twitter.com/python_tip/status/1317385160350892032,[],"[{'url': 'https://t.co/5Jfpfgahjf', 'media_url': 'http://pbs.twimg.com/media/EkhKuY6XUAACLsO.png', 'display_url': 'pic.twitter.com/5Jfpfgahjf'}]"
1316837225867468800,2020-10-15 20:23:54+00:00,153,21,"Merging Dictionaries - new in Python 3.9!
a | b will merge `b` dictionary into `a` dictionary, if there are conflicts, the rightmost-value will be kept
a |= b will merge `b` into `a` and return the result in `a` (it is also called updating)
Example: 👇 https://t.co/HlrVf8k0vn",False,False,https://twitter.com/python_tip/status/1316837225867468800,[],"[{'url': 'https://t.co/HlrVf8k0vn', 'media_url': 'http://pbs.twimg.com/media/EkZYQ8wWsAEjZhF.jpg', 'display_url': 'pic.twitter.com/HlrVf8k0vn'}]"
1315796911430029318,2020-10-12 23:30:04+00:00,74,22,"Streamlit (beautiful data apps in hours, not weeks; all in pure Python) is now introducing more flexible layout.
If you are new to Streamlit, create your first app after reading this, https://t.co/nlSTpaA9yH https://t.co/7poJOOVxqj",False,False,https://twitter.com/python_tip/status/1315796911430029318,"[{'url': 'https://t.co/nlSTpaA9yH', 'expanded_url': 'https://towardsdatascience.com/streamlit-101-an-in-depth-introduction-fc8aad9492f2', 'display_url': 'towardsdatascience.com/streamlit-101-…'}, {'url': 'https://t.co/7poJOOVxqj', 'expanded_url': 'https://twitter.com/streamlit/status/1314325156622266368', 'display_url': 'twitter.com/streamlit/stat…'}]",[]
1314561051581722625,2020-10-09 13:39:12+00:00,46,18,"Chaining of comparison operators:
>>> 0 < 10 != 1 < 5
True
# 0 < 10 and 10 != 1 and 1 < 5
#python",False,False,https://twitter.com/python_tip/status/1314561051581722625,[],[]
1314129787112296451,2020-10-08 09:05:31+00:00,29,9,"Slices with negative indexing
>>> a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
>>> a[-4:-2]
[7, 8]
More slicing tips at https://t.co/CWt7WIWjDG",False,False,https://twitter.com/python_tip/status/1314129787112296451,"[{'url': 'https://t.co/CWt7WIWjDG', 'expanded_url': 'http://sahandsaba.com/thirty-python-language-features-and-tricks-you-may-not-know.html#id1', 'display_url': 'sahandsaba.com/thirty-python-…'}]",[]
1313565408251740160,2020-10-06 19:42:52+00:00,86,28,"#python 3.9 is out!
https://t.co/lEP9z9g5TT",False,False,https://twitter.com/python_tip/status/1313565408251740160,"[{'url': 'https://t.co/lEP9z9g5TT', 'expanded_url': 'https://docs.python.org/3.9/whatsnew/3.9.html', 'display_url': 'docs.python.org/3.9/whatsnew/3…'}]",[]
1313226474607042560,2020-10-05 21:16:04+00:00,0,0,RT @ThePSF: Help us map out an accurate landscape of the Python community – join the official Python Survey 2020. https://t.co/devKyhusbN,False,True,https://twitter.com/python_tip/status/1313226474607042560,"[{'url': 'https://t.co/devKyhusbN', 'expanded_url': 'https://surveys.jetbrains.com/s3/c12-python-developers-survey-2020', 'display_url': 'surveys.jetbrains.com/s3/c12-python-…'}]",[]
1313220455914971141,2020-10-05 20:52:09+00:00,54,13,"Turn your #jupyter notebooks into slides with the RISE extension
https://t.co/46sgpUbaw2 https://t.co/n86PzZMN0f",False,False,https://twitter.com/python_tip/status/1313220455914971141,"[{'url': 'https://t.co/46sgpUbaw2', 'expanded_url': 'https://rise.readthedocs.io/en/stable/', 'display_url': 'rise.readthedocs.io/en/stable/'}]","[{'url': 'https://t.co/n86PzZMN0f', 'media_url': 'http://pbs.twimg.com/tweet_video_thumb/Ejl-4mBWAAAaBXT.jpg', 'display_url': 'pic.twitter.com/n86PzZMN0f'}]"
1312523832297582594,2020-10-03 22:44:01+00:00,194,47,"AutoScraper: give it a URL and an example what would you like to scrape, and it learns the scraping rules and returns similar elements
https://t.co/38avVIvoBc
Example: web page, code, results https://t.co/gFXQWvsiS6",False,False,https://twitter.com/python_tip/status/1312523832297582594,"[{'url': 'https://t.co/38avVIvoBc', 'expanded_url': 'https://medium.com/better-programming/introducing-autoscraper-a-smart-fast-and-lightweight-web-scraper-for-python-20987f52c749', 'display_url': 'medium.com/better-program…'}]","[{'url': 'https://t.co/gFXQWvsiS6', 'media_url': 'http://pbs.twimg.com/media/EjcE70ZXsAESsVb.png', 'display_url': 'pic.twitter.com/gFXQWvsiS6'}]"
1311683042067480578,2020-10-01 15:03:01+00:00,64,22,"To create a zip/tar archive of a folder, use shutil.make_archive:
>>> import shutil
>>> shutil.make_archive(output_filename, 'zip', dir_name)
Thanks @pndrej for the tip.",False,False,https://twitter.com/python_tip/status/1311683042067480578,[],[]
1311406200270053377,2020-09-30 20:42:57+00:00,143,41,"bpython = fancy interface to the Python interactive interpreter (with auto completion, highlighting, auto indent)
See https://t.co/FYwPvTC0Pr https://t.co/HMcE366K41",False,False,https://twitter.com/python_tip/status/1311406200270053377,"[{'url': 'https://t.co/FYwPvTC0Pr', 'expanded_url': 'https://bpython-interpreter.org/', 'display_url': 'bpython-interpreter.org'}]","[{'url': 'https://t.co/HMcE366K41', 'media_url': 'http://pbs.twimg.com/tweet_video_thumb/EjMMtEVWsAQrXbS.jpg', 'display_url': 'pic.twitter.com/HMcE366K41'}]"
1311403454108229632,2020-09-30 20:32:02+00:00,1,0,@NurmeAve Thanks for the great tip!,True,False,https://twitter.com/python_tip/status/1311403454108229632,[],[]
1311069231182753793,2020-09-29 22:23:57+00:00,95,27,"You can save memory by fixing types in your #pandas DataFrame
https://t.co/HjD4toofDM https://t.co/v1iu8IqWWr",False,False,https://twitter.com/python_tip/status/1311069231182753793,"[{'url': 'https://t.co/HjD4toofDM', 'expanded_url': 'https://www.kaggle.com/python10pm/pandas-100-tricks#Trick-94:-Save-memory-by-fixing-your-date', 'display_url': 'kaggle.com/python10pm/pan…'}]","[{'url': 'https://t.co/v1iu8IqWWr', 'media_url': 'http://pbs.twimg.com/media/EjHafqBXsAMpEZy.png', 'display_url': 'pic.twitter.com/v1iu8IqWWr'}]"
1310532251441037312,2020-09-28 10:50:11+00:00,27,14,"Good news! IPywidgets (library providing easy way to add interactivity to your Jupyter notebooks) finally works in Google Colaboratory.
Try to run example browsing MNIST images:
https://t.co/LpFyhM4OVE https://t.co/YXoP7xBA4Q",False,False,https://twitter.com/python_tip/status/1310532251441037312,"[{'url': 'https://t.co/LpFyhM4OVE', 'expanded_url': 'https://colab.research.google.com/github/jupyter-widgets/ipywidgets/blob/master/docs/source/examples/Image%20Browser.ipynb#scrollTo=Qbb4ZcsETj0Q', 'display_url': 'colab.research.google.com/github/jupyter…'}]","[{'url': 'https://t.co/YXoP7xBA4Q', 'media_url': 'http://pbs.twimg.com/media/Ei_xEa-XgAUtn50.jpg', 'display_url': 'pic.twitter.com/YXoP7xBA4Q'}]"
1309412744949571585,2020-09-25 08:41:40+00:00,22,11,"#PyCon Turkey - this Saturday, fully online and free
https://t.co/dJrSDDk6Ty",False,False,https://twitter.com/python_tip/status/1309412744949571585,"[{'url': 'https://t.co/dJrSDDk6Ty', 'expanded_url': 'https://tr.pycon.org/', 'display_url': 'tr.pycon.org'}]",[]
1309070062393978881,2020-09-24 09:59:58+00:00,126,31,">>> a = 1
>>> b = 5
>>> a, b = b, a
>>> a
5
>>> b
1
#Python https://t.co/r5Tr75i3pJ",False,False,https://twitter.com/python_tip/status/1309070062393978881,[],"[{'url': 'https://t.co/r5Tr75i3pJ', 'media_url': 'http://pbs.twimg.com/media/EirAMl9WkAA4Xzg.jpg', 'display_url': 'pic.twitter.com/r5Tr75i3pJ'}]"
1308676662494662656,2020-09-23 07:56:45+00:00,112,22,"Guess the result:
>>> lst = [0, 1, 2]
>>> lst[-1] += lst.pop()
>>> lst
#python_tip by @irdb",False,False,https://twitter.com/python_tip/status/1308676662494662656,[],[]
1308124412210802690,2020-09-21 19:22:18+00:00,60,18,"#Python3 Tip from @rickjdon: To zip 2 lists of different lengths use ‘zip_longest()’.
from itertools import zip_longest
x =[1, 2] ; y =[3]
list(zip_longest(x, y))
[(1, 3), (2, None)]
https://t.co/Ar5otciOxS",False,False,https://twitter.com/python_tip/status/1308124412210802690,"[{'url': 'https://t.co/Ar5otciOxS', 'expanded_url': 'https://docs.python.org/3/library/itertools.html', 'display_url': 'docs.python.org/3/library/iter…'}]",[]
1307306189886312449,2020-09-19 13:10:58+00:00,51,18,"Programming in @TensorFlow by example.
This might sound like magic but with TF-Coder, you provide an input/output example, and TF-Coder finds the appropriate TensorFlow code for this transformation.
Try it out → https://t.co/88CHbucR6G https://t.co/IM3I75UroF",False,False,https://twitter.com/python_tip/status/1307306189886312449,"[{'url': 'https://t.co/88CHbucR6G', 'expanded_url': 'https://goo.gle/3gtexPX', 'display_url': 'goo.gle/3gtexPX'}]","[{'url': 'https://t.co/IM3I75UroF', 'media_url': 'http://pbs.twimg.com/media/EiR7osEXsAA_ufE.png', 'display_url': 'pic.twitter.com/IM3I75UroF'}]"
1306733380105654277,2020-09-17 23:14:50+00:00,55,13,"To convert data from wide df into a long one, use DataFrame.melt
Example:
https://t.co/j5U0ofJHAd https://t.co/G9ADnglRPN",False,False,https://twitter.com/python_tip/status/1306733380105654277,"[{'url': 'https://t.co/j5U0ofJHAd', 'expanded_url': 'https://www.kaggle.com/python10pm/pandas-100-tricks#Trick-98:-Convert-a-wide-DF-into-a-long-one', 'display_url': 'kaggle.com/python10pm/pan…'}]","[{'url': 'https://t.co/G9ADnglRPN', 'media_url': 'http://pbs.twimg.com/media/EiJzBo8XYAEYv9f.png', 'display_url': 'pic.twitter.com/G9ADnglRPN'}]"
1306228363766435840,2020-09-16 13:48:05+00:00,174,35,"#pythontip by @NurmeAve:
You can use an asterisk for unpacking and with any separator (for printing) you like.
A few examples shown below. https://t.co/kXN3JMVvTU",False,False,https://twitter.com/python_tip/status/1306228363766435840,[],"[{'url': 'https://t.co/kXN3JMVvTU', 'media_url': 'http://pbs.twimg.com/media/EiCncHaWoAEZk7-.jpg', 'display_url': 'pic.twitter.com/kXN3JMVvTU'}]"
1305950746962264066,2020-09-15 19:24:56+00:00,47,19,"Is conda package manager too slow for you? Try a drop-in replacement mamba:
conda install mamba -c conda-forge
and you can then install conda packages as follows
mamba install PACKAGE_NAME -c conda-forge
https://t.co/QFvd6QVA5m",False,False,https://twitter.com/python_tip/status/1305950746962264066,"[{'url': 'https://t.co/QFvd6QVA5m', 'expanded_url': 'https://github.com/mamba-org/mamba', 'display_url': 'github.com/mamba-org/mamba'}]",[]
1305626873137950724,2020-09-14 21:57:58+00:00,35,14,"Comparison of the most popular libraries for exploratory visualizations: pandas, seaborn, plotnine, plotly, altair & ggplot2 (R).
It can be also used as a Rosetta stone on typical exploratory plots.
https://t.co/eZTWeV9old https://t.co/48eiYLcqKO",False,False,https://twitter.com/python_tip/status/1305626873137950724,"[{'url': 'https://t.co/eZTWeV9old', 'expanded_url': 'http://pythonplot.com', 'display_url': 'pythonplot.com'}, {'url': 'https://t.co/48eiYLcqKO', 'expanded_url': 'https://twitter.com/SciPyTip/status/1305528017079459840', 'display_url': 'twitter.com/SciPyTip/statu…'}]",[]
1304428483683123202,2020-09-11 14:36:00+00:00,27,5,"Let's go back to 80s and create full screen text UIs with asciimatics
https://t.co/lx0dYhWoFy https://t.co/eZWjr1AVlN",False,False,https://twitter.com/python_tip/status/1304428483683123202,"[{'url': 'https://t.co/lx0dYhWoFy', 'expanded_url': 'https://github.com/peterbrittain/asciimatics', 'display_url': 'github.com/peterbrittain/…'}]","[{'url': 'https://t.co/eZWjr1AVlN', 'media_url': 'http://pbs.twimg.com/media/EhZhi_uX0AArO0d.png', 'display_url': 'pic.twitter.com/eZWjr1AVlN'}]"
1304067102685294592,2020-09-10 14:40:00+00:00,60,14,"#python_tip from @NurmeAve:
Python's divmod() is one way to convert months into years and months:
divmod(1, 12) # (0, 1) -> 0 years & 1 month
divmod(12, 12) # (1, 0) -> 1 year & 0 months
divmod(55, 12) # (4, 7) -> 4 years & 7 months",False,False,https://twitter.com/python_tip/status/1304067102685294592,[],[]
1303702449669111815,2020-09-09 14:31:00+00:00,78,21,"Create a zip archive in #python:
from zipfile import ZipFile
with ZipFile('https://t.co/6ASg62olYM', 'w') as zip_ref:
zip_ref.write('data.csv')
zip_ref.write('test.log')",False,False,https://twitter.com/python_tip/status/1303702449669111815,"[{'url': 'https://t.co/6ASg62olYM', 'expanded_url': 'http://my.zip', 'display_url': 'my.zip'}]",[]
1303329692913668101,2020-09-08 13:49:48+00:00,273,67,"Use handcalcs as #Jupyter cell magic to render python calculation code in LaTeX
https://t.co/aWIriXDfyw https://t.co/hNWPIA5ZxT",False,False,https://twitter.com/python_tip/status/1303329692913668101,"[{'url': 'https://t.co/aWIriXDfyw', 'expanded_url': 'https://github.com/connorferster/handcalcs', 'display_url': 'github.com/connorferster/…'}]","[{'url': 'https://t.co/hNWPIA5ZxT', 'media_url': 'http://pbs.twimg.com/tweet_video_thumb/EhZbRSrWkAEVKC5.jpg', 'display_url': 'pic.twitter.com/hNWPIA5ZxT'}]"
1302964972352417793,2020-09-07 13:40:31+00:00,68,23,"#python_tip by @raymondh:
several ways to interactively display results of a calculation:
# Two liner
>>> q = 3.5 * 1.5
>>> q
5.25
# Second expression
>>> q = 3.5 * 1.5; q
5.25
# Walrus
>>> (q := 3.5 * 1.5)
5.25
# Invisible
>>> q = 3.5 * 1.5",False,False,https://twitter.com/python_tip/status/1302964972352417793,[],[]
1302549942905573376,2020-09-06 10:11:21+00:00,0,0,RT @dwightwgunning: @python_tip @delegates @Patch @HamelHusain You probably mean #fastcore not #fastpages,False,True,https://twitter.com/python_tip/status/1302549942905573376,[],[]
1302549866778951680,2020-09-06 10:11:03+00:00,0,0,"@dwightwgunning @delegates @Patch @HamelHusain Thank you. Of course, you are right.",True,False,https://twitter.com/python_tip/status/1302549866778951680,[],[]
1302361473046515714,2020-09-05 21:42:26+00:00,44,12,"#fastpages is a backbone of #fastai library that brings advanced Python constructs like @typedispatch, store_attr(), @delegates, @patch, ...
See examples 👇 and read intro from @HamelHusain
https://t.co/pwYi4TdWy1 https://t.co/qzcaVa4PjW",False,False,https://twitter.com/python_tip/status/1302361473046515714,"[{'url': 'https://t.co/pwYi4TdWy1', 'expanded_url': 'https://fastpages.fast.ai/fastcore/', 'display_url': 'fastpages.fast.ai/fastcore/'}]","[{'url': 'https://t.co/qzcaVa4PjW', 'media_url': 'http://pbs.twimg.com/media/EhLp_C3XcAEt1jq.png', 'display_url': 'pic.twitter.com/qzcaVa4PjW'}]"
1301768959075577857,2020-09-04 06:28:00+00:00,40,12,"#einops library = easy manipulation of multidimensional arrays (not only #numpy, but also #PyTorch, #TF, #jax...)
E.g. Instead of
y = x.view(x.shape[0], -1)
you can express the same as
y = rearrange(x, 'b c h w -> b (c h w)') https://t.co/uSM6NksMJ9",False,False,https://twitter.com/python_tip/status/1301768959075577857,[],"[{'url': 'https://t.co/uSM6NksMJ9', 'media_url': 'http://pbs.twimg.com/tweet_video_thumb/Eg3XvHdXcAEsj2c.jpg', 'display_url': 'pic.twitter.com/uSM6NksMJ9'}]"
1301404054732468225,2020-09-03 06:18:00+00:00,14,9,"patsy - Python implementation of R's formulas and design matrices
https://t.co/pkbtnrmiii",False,False,https://twitter.com/python_tip/status/1301404054732468225,"[{'url': 'https://t.co/pkbtnrmiii', 'expanded_url': 'https://patsy.readthedocs.io/en/latest/quickstart.html', 'display_url': 'patsy.readthedocs.io/en/latest/quic…'}]",[]
1301039905347231749,2020-09-02 06:11:00+00:00,207,68,"Python 3.9 is coming!
Check the new features:
* Dictionary merge (|) and update (|=) operators
* removeprefix() and removesuffix() string methods
* Easier type annotations for lists and dicts
* ...
https://t.co/lEP9z8Yuvj",False,False,https://twitter.com/python_tip/status/1301039905347231749,"[{'url': 'https://t.co/lEP9z8Yuvj', 'expanded_url': 'https://docs.python.org/3.9/whatsnew/3.9.html', 'display_url': 'docs.python.org/3.9/whatsnew/3…'}]",[]
1300921345824481280,2020-09-01 22:19:53+00:00,19,8,"Our 3h intro into Deep Learning at European Conference on Computational Biology. Six colab exercises.
https://t.co/lNfmdhJV1V
#ECCB2020 #selfpromo https://t.co/D3WGvsBqYD",False,False,https://twitter.com/python_tip/status/1300921345824481280,"[{'url': 'https://t.co/lNfmdhJV1V', 'expanded_url': 'https://github.com/ML-Bioinfo-CEITEC/ECCB2020', 'display_url': 'github.com/ML-Bioinfo-CEI…'}, {'url': 'https://t.co/D3WGvsBqYD', 'expanded_url': 'https://twitter.com/simecek/status/1300824293954277377', 'display_url': 'twitter.com/simecek/status…'}]",[]
1300793389802233856,2020-09-01 13:51:26+00:00,519,164,"handcalcs - a library to render Python calculation code automatically in Latex (+some extra magic allowing numeric substitutions into formula) -- via @omarsar0
https://t.co/aWIriXDfyw https://t.co/C8LOYm301K",False,False,https://twitter.com/python_tip/status/1300793389802233856,"[{'url': 'https://t.co/aWIriXDfyw', 'expanded_url': 'https://github.com/connorferster/handcalcs', 'display_url': 'github.com/connorferster/…'}]","[{'url': 'https://t.co/C8LOYm301K', 'media_url': 'http://pbs.twimg.com/tweet_video_thumb/Eg1Yr2TXsAAYxRL.jpg', 'display_url': 'pic.twitter.com/C8LOYm301K'}]"
1299263830984478722,2020-08-28 08:33:31+00:00,61,11,"You can write #pandas objects directly to compressed format.
By default, Pandas will infer the file type:
>>> https://t.co/yGT52QVczk_csv('https://t.co/7Ehn0xJHET')
or you can specify the mode:
>>> https://t.co/yGT52QVczk_csv('data.csv.gz', compression='gzip’)",False,False,https://twitter.com/python_tip/status/1299263830984478722,"[{'url': 'https://t.co/yGT52QVczk', 'expanded_url': 'http://df.to', 'display_url': 'df.to'}, {'url': 'https://t.co/yGT52QVczk', 'expanded_url': 'http://df.to', 'display_url': 'df.to'}]",[]
1298875354325700608,2020-08-27 06:49:51+00:00,0,0,RT @starenka: @python_tip collections.Counter.most_common is faster afaik,False,True,https://twitter.com/python_tip/status/1298875354325700608,[],[]
1298730513042157570,2020-08-26 21:14:18+00:00,174,28,"#python lists have the count() method that returns the number of occurrences of an element:
>>> lst = [1, 1, 2, 3, 4, 5, 1, 3, 3, 3, 7, 9, 3]
>>> lst.count(2)
1
Most common item:
>>> max(lst, key=lst.count)
3",False,False,https://twitter.com/python_tip/status/1298730513042157570,[],[]
1298373969729466368,2020-08-25 21:37:31+00:00,40,12,"HTTPX is an asyncio HTTP client library, with an API almost identical to Requests.
https://t.co/o1DC7Xkm2Z
thanks @jdbowman for today's #python_tip",False,False,https://twitter.com/python_tip/status/1298373969729466368,"[{'url': 'https://t.co/o1DC7Xkm2Z', 'expanded_url': 'https://github.com/encode/httpx', 'display_url': 'github.com/encode/httpx'}]",[]
1297992779335950336,2020-08-24 20:22:48+00:00,19,9,"in is a comparison operator and so it is subject to comparison chaining:
>>> l = ['b', 'c']
>>> 'b' in l == True
False
>>> 'a' in 'bar' < 'baz'
True
https://t.co/4dC3kLS6rZ
#python",False,False,https://twitter.com/python_tip/status/1297992779335950336,"[{'url': 'https://t.co/4dC3kLS6rZ', 'expanded_url': 'https://docs.python.org/3/reference/expressions.html#comparisons', 'display_url': 'docs.python.org/3/reference/ex…'}]",[]
1297461499489853441,2020-08-23 09:11:41+00:00,38,7,"New @fastdotai deep learning course
https://t.co/epzZhv1VVf
...coming with a book written in Jupyter notebooks
https://t.co/NujNeSAJVF
https://t.co/xe1paL38wT
...and a complete rewrite of the library
https://t.co/vIg5tG6o1L",False,False,https://twitter.com/python_tip/status/1297461499489853441,"[{'url': 'https://t.co/epzZhv1VVf', 'expanded_url': 'https://course.fast.ai/', 'display_url': 'course.fast.ai'}, {'url': 'https://t.co/NujNeSAJVF', 'expanded_url': 'https://github.com/fastai/fastbook', 'display_url': 'github.com/fastai/fastbook'}, {'url': 'https://t.co/xe1paL38wT', 'expanded_url': 'https://www.amazon.com/Deep-Learning-Coders-fastai-PyTorch/dp/1492045527', 'display_url': 'amazon.com/Deep-Learning-…'}, {'url': 'https://t.co/vIg5tG6o1L', 'expanded_url': 'https://www.fast.ai/2020/08/21/fastai2-launch/', 'display_url': 'fast.ai/2020/08/21/fas…'}]",[]
1297211319721103362,2020-08-22 16:37:34+00:00,0,0,@thelinekioubeur @abhi_bops Thanks!,True,False,https://twitter.com/python_tip/status/1297211319721103362,[],[]
1297056658581905408,2020-08-22 06:23:00+00:00,60,10,"#pythontip by @abhi_bops:
If you want to split a string and use the individual elements but worried about getting IndexError.
>> a='x/y/z'
>> d={n:i for n, i in enumerate(a.split('/'))}
>> d.get(1)
'y'
>> d.get(10)
(Contribute tips by tagging us or use https://t.co/mfUQ9twkWS)",False,False,https://twitter.com/python_tip/status/1297056658581905408,"[{'url': 'https://t.co/mfUQ9twkWS', 'expanded_url': 'http://bit.ly/pythontip', 'display_url': 'bit.ly/pythontip'}]",[]
1296690999171772416,2020-08-21 06:10:00+00:00,166,40,"Tqdm is a well known tool for progress bars. But did you know you can have double progress bars and name them?
Colab: 👇👇
https://t.co/gIWJ2e9jAJ https://t.co/v2ltoUDK15",False,False,https://twitter.com/python_tip/status/1296690999171772416,"[{'url': 'https://t.co/gIWJ2e9jAJ', 'expanded_url': 'https://gist.github.com/simecek/0ee10e9d1fbc54c156b566386ca6806f', 'display_url': 'gist.github.com/simecek/0ee10e…'}]","[{'url': 'https://t.co/v2ltoUDK15', 'media_url': 'http://pbs.twimg.com/media/EftfFpDWkAgXYJM.png', 'display_url': 'pic.twitter.com/v2ltoUDK15'}]"
1296328244099272706,2020-08-20 06:08:32+00:00,46,8,"Floating point math is hard.
>>> 0.1 + 0.2
0.30000000000000004
>>> 0.4 == 0.399999999999999999
True
>>> 0.399999999999999999 == 0.399999999999999998
True https://t.co/nk1YUmOJu8",False,False,https://twitter.com/python_tip/status/1296328244099272706,"[{'url': 'https://t.co/nk1YUmOJu8', 'expanded_url': 'https://twitter.com/jakevdp/status/1296127415551311874', 'display_url': 'twitter.com/jakevdp/status…'}]",[]
1295975534783090688,2020-08-19 06:47:00+00:00,78,20,"To get memory usage of DataFrame and its every column:
https://t.co/8vD3tlajX5(memory_usage = ""deep"")
df.memory_usage(deep = True)
https://t.co/tkf1jzdSoC
#pandas",False,False,https://twitter.com/python_tip/status/1295975534783090688,"[{'url': 'https://t.co/8vD3tlajX5', 'expanded_url': 'http://df.info', 'display_url': 'df.info'}, {'url': 'https://t.co/tkf1jzdSoC', 'expanded_url': 'https://www.kaggle.com/python10pm/pandas-100-tricks#Trick-19:-Show-memory-usage-of-a-df-and-every-column', 'display_url': 'kaggle.com/python10pm/pan…'}]",[]
1295728392491368449,2020-08-18 14:24:56+00:00,2,0,@neilbhav @michalovamichle It is easy to overlook missing brackets and then be surprised by the program behavior.,True,False,https://twitter.com/python_tip/status/1295728392491368449,[],[]
1295723815952166912,2020-08-18 14:06:45+00:00,61,16,"By default, Python objects are evaluated as true. Sometimes, it might bite you.
def muFunc():
return False
>>> if myFunc:
print(""OMG!"")
OMG! https://t.co/kZDwNyC6Dh",False,False,https://twitter.com/python_tip/status/1295723815952166912,"[{'url': 'https://t.co/kZDwNyC6Dh', 'expanded_url': 'https://twitter.com/raymondh/status/1278477169237176320', 'display_url': 'twitter.com/raymondh/statu…'}]",[]
1295352184213823489,2020-08-17 13:30:01+00:00,14,2,"@AjayKaphola A solution using pathlib (instead of os):
from pathlib import Path
file_path = './folder1/folder2/file.txt'
p = Path(file_path)
p.parents[0].mkdir(parents=True, exist_ok=True)
p.write_text(""Sample file content"")
https://t.co/9eDp1MMd2i_text() # will read the file content https://t.co/Zuaowldgjj",True,False,https://twitter.com/python_tip/status/1295352184213823489,"[{'url': 'https://t.co/9eDp1MMd2i', 'expanded_url': 'http://p.read', 'display_url': 'p.read'}]","[{'url': 'https://t.co/Zuaowldgjj', 'media_url': 'http://pbs.twimg.com/media/EfoD3e4XgAAxm3t.jpg', 'display_url': 'pic.twitter.com/Zuaowldgjj'}]"
1295350942712332288,2020-08-17 13:25:05+00:00,38,8,"#pythontip from @AjayKaphola to create a file with parent folders:
file_path = '/folder1/folder2/file.txt'
os.makedirs(os.path.dirname(file_path ), exist_ok=True)
with open(file_path , ""w"") as f:
f.write(""Sample file content"") https://t.co/uKTYyXArtw",False,False,https://twitter.com/python_tip/status/1295350942712332288,[],"[{'url': 'https://t.co/uKTYyXArtw', 'media_url': 'http://pbs.twimg.com/media/EfoCwyZXsAE_Mi5.jpg', 'display_url': 'pic.twitter.com/uKTYyXArtw'}]"
1294141161334960128,2020-08-14 05:17:51+00:00,0,0,RT @starenka: @python_tip vars(obj) whats inside,False,True,https://twitter.com/python_tip/status/1294141161334960128,[],[]
1294033102738722816,2020-08-13 22:08:28+00:00,58,16,"type() - what is this object?
dir() - what can I do with it?
help()
>>> type(df)
<class 'pandas.core.frame.DataFrame'>
>>> dir(df)
>>> help(https://t.co/yGT52QVczk_latex)
#Python",False,False,https://twitter.com/python_tip/status/1294033102738722816,"[{'url': 'https://t.co/yGT52QVczk', 'expanded_url': 'http://df.to', 'display_url': 'df.to'}]",[]
1293667821562593281,2020-08-12 21:56:58+00:00,64,15,"When maxsplit is specified in str.split(), it will limit the number of splits:
>>> s = 'a,,b, c, d,e'
>>> s.split(',')
['a', '', 'b', ' c', ' d', 'e']
>>> s.split(',', maxsplit=2)
['a', '', 'b, c, d,e']
>>> s.split(maxsplit=2)
['a,,b,', 'c,', 'd,e']
https://t.co/o3YxgkOwUj",False,False,https://twitter.com/python_tip/status/1293667821562593281,"[{'url': 'https://t.co/o3YxgkOwUj', 'expanded_url': 'https://docs.python.org/3/library/stdtypes.html#str.split', 'display_url': 'docs.python.org/3/library/stdt…'}]",[]
1293314816480878592,2020-08-11 22:34:15+00:00,103,24,"Table in pdf? No problem :-)
>>> from tabula import read_pdf
>>> df_lst = read_pdf(""some.pdf"", pages = ""all"")
https://t.co/3zd1DHySjz",False,False,https://twitter.com/python_tip/status/1293314816480878592,"[{'url': 'https://t.co/3zd1DHySjz', 'expanded_url': 'https://pypi.org/project/tabula-py/', 'display_url': 'pypi.org/project/tabula…'}]",[]
1292795622333067270,2020-08-10 12:11:10+00:00,35,16,"randint(a, b) returns random number between a and b, but be careful: b is inclusive if random.randint is used, but exclusive if np.random.randint is used
Thanks, @PetraVidnerova!
Do you have a #python_tip? Share it with us: https://t.co/NXevFNKLXH",False,False,https://twitter.com/python_tip/status/1292795622333067270,"[{'url': 'https://t.co/NXevFNKLXH', 'expanded_url': 'https://bit.ly/pythontip', 'display_url': 'bit.ly/pythontip'}]",[]
1292791585344815104,2020-08-10 11:55:07+00:00,0,0,@starenka Cool. I did not know that.,True,False,https://twitter.com/python_tip/status/1292791585344815104,[],[]
1291618575757848576,2020-08-07 06:14:00+00:00,48,17,"Sometimes, you run into a project using dependency management tool, unknown to you. To get some overview, read
https://t.co/Gq5uQa0ds7
(Personally, I am #pyenv guy, most my colleagues like #conda and I have just run into my 1st #poetry project) https://t.co/Jb0eciKdoz",False,False,https://twitter.com/python_tip/status/1291618575757848576,"[{'url': 'https://t.co/Gq5uQa0ds7', 'expanded_url': 'https://modelpredict.com/python-dependency-management-tools', 'display_url': 'modelpredict.com/python-depende…'}]","[{'url': 'https://t.co/Jb0eciKdoz', 'media_url': 'http://pbs.twimg.com/media/EehxSZbXkAIrmek.png', 'display_url': 'pic.twitter.com/Jb0eciKdoz'}]"
1291261975960395776,2020-08-06 06:37:00+00:00,17,6,"#vscode like online IDE for your GitHub repo
https://t.co/t10odSysbZ",False,False,https://twitter.com/python_tip/status/1291261975960395776,"[{'url': 'https://t.co/t10odSysbZ', 'expanded_url': 'https://gitpod.io/#get-started', 'display_url': 'gitpod.io/#get-started'}]",[]
1290901601368997888,2020-08-05 06:45:00+00:00,18,3,"Python 3.7+ contains a dummy context manager contextlib.nullcontext that does nothing. For more information, see this thread
https://t.co/T6JycCShBl
And you can even pass an argument
>>> with contextlib.nullcontext('world') as planet:
print('Hello', planet)
Hello world",False,False,https://twitter.com/python_tip/status/1290901601368997888,"[{'url': 'https://t.co/T6JycCShBl', 'expanded_url': 'https://twitter.com/raymondh/status/1280666652812562432', 'display_url': 'twitter.com/raymondh/statu…'}]",[]
1290536445401354240,2020-08-04 06:34:00+00:00,54,15,"#pythontip by @fgomezdelarosa_:
df.columns = [x.replace(' ', '_').lower() for x in df.columns]
replace spaces and transform in lowercase the variable names in df columns.
(Do you know a good Python tip? Just tag us the tweet, or even better, fill it to https://t.co/mfUQ9teK5k)",False,False,https://twitter.com/python_tip/status/1290536445401354240,"[{'url': 'https://t.co/mfUQ9teK5k', 'expanded_url': 'http://bit.ly/pythontip', 'display_url': 'bit.ly/pythontip'}]",[]
1290393929221918722,2020-08-03 21:07:41+00:00,196,54,"Youtube-dl: Python package to download YouTube videos (also a command line tool).
https://t.co/MCAMQcpRVc https://t.co/VRYDEPYqrr",False,False,https://twitter.com/python_tip/status/1290393929221918722,"[{'url': 'https://t.co/MCAMQcpRVc', 'expanded_url': 'https://github.com/ytdl-org/youtube-dl#embedding-youtube-dl', 'display_url': 'github.com/ytdl-org/youtu…'}]","[{'url': 'https://t.co/VRYDEPYqrr', 'media_url': 'http://pbs.twimg.com/media/EehmAABWAAEyja7.png', 'display_url': 'pic.twitter.com/VRYDEPYqrr'}]"
1288802911070359552,2020-07-30 11:45:33+00:00,31,17,"you can use user-defined separator and end parameters in print():
print(*objects, sep=' ', end='\n', file=sys.stdout, flush=False)
print('a', 'b', sep='_')
a_b
print('a', end=',')
print('b', end=',')
print('c')
a,b,c
#python
https://t.co/Jm8LgioMJb",False,False,https://twitter.com/python_tip/status/1288802911070359552,"[{'url': 'https://t.co/Jm8LgioMJb', 'expanded_url': 'https://docs.python.org/3/library/functions.html#print', 'display_url': 'docs.python.org/3/library/func…'}]",[]
1288485781103935491,2020-07-29 14:45:23+00:00,56,9,"Need to double check your working directory?
>>> import os
>>> os.getcwd()
'/home/karla/some/strange/folder'
#python",False,False,https://twitter.com/python_tip/status/1288485781103935491,[],[]
1288073549928894465,2020-07-28 11:27:20+00:00,13,11,"#python + #pyjamas = Pyjamas.
https://t.co/djc67EwQCD
Rule number 1 of Pyjamas is “One shall present your talk wearing pyjamas”.",False,False,https://twitter.com/python_tip/status/1288073549928894465,"[{'url': 'https://t.co/djc67EwQCD', 'expanded_url': 'https://pyjamas.live/', 'display_url': 'pyjamas.live'}]",[]
1287755095686471681,2020-07-27 14:21:54+00:00,51,17,"use dtypes=None in numpy.genfromtxt() to auto detect data types by column.
#numpy #python https://t.co/flFSTEiyKi",False,False,https://twitter.com/python_tip/status/1287755095686471681,[],"[{'url': 'https://t.co/flFSTEiyKi', 'media_url': 'http://pbs.twimg.com/media/Ed8GZYuWkAA68Ks.png', 'display_url': 'pic.twitter.com/flFSTEiyKi'}]"
1286577861239828480,2020-07-24 08:24:00+00:00,30,10,"Real-time data streaming using #FastAPI and #WebSocket by @stribrny
https://t.co/EaJ74T7k26 https://t.co/Q5cn30udVN",False,False,https://twitter.com/python_tip/status/1286577861239828480,"[{'url': 'https://t.co/EaJ74T7k26', 'expanded_url': 'https://stribny.name/blog/2020/07/real-time-data-streaming-using-fastapi-and-websockets', 'display_url': 'stribny.name/blog/2020/07/r…'}]","[{'url': 'https://t.co/Q5cn30udVN', 'media_url': 'http://pbs.twimg.com/media/Edb24gMXYAkTbad.png', 'display_url': 'pic.twitter.com/Q5cn30udVN'}]"
1286179738059280386,2020-07-23 06:02:00+00:00,62,16,"Style #pandas DataFrame (using formatting dictionary):
https://t.co/fDsq4B3JD0 https://t.co/j5NFi1FBml",False,False,https://twitter.com/python_tip/status/1286179738059280386,"[{'url': 'https://t.co/fDsq4B3JD0', 'expanded_url': 'https://www.kaggle.com/python10pm/pandas-100-tricks#Trick-26:-Formatting-different-columns-of-a-df-(using-dictionaries)', 'display_url': 'kaggle.com/python10pm/pan…'}]","[{'url': 'https://t.co/j5NFi1FBml', 'media_url': 'http://pbs.twimg.com/media/Edb_RuYXoAESM88.png', 'display_url': 'pic.twitter.com/j5NFi1FBml'}]"
1285815840013615104,2020-07-22 05:56:00+00:00,87,25,"To find the index of minimum element in a list:
> a = [2, 1, 3]
> a.index(min(a))
1
> # another solution (single pass)
> min(enumerate(a), key=lambda x: x[1])[0]
1
To get all positions of minima:
> a = [2, 1, 3, 1]
> m = min(a)
> [i for i, j in enumerate(a) if j == m]
[1, 3]",False,False,https://twitter.com/python_tip/status/1285815840013615104,[],[]
1285484781850038272,2020-07-21 08:00:29+00:00,68,20,"To download (large) files from Google drive without mounting the drive:
from google_drive_downloader import GoogleDriveDownloader as gdd
https://t.co/E7HjHdAma5_file_from_google_drive(file_id='**GDRIVE_FILE_ID**', dest_path='local.pkl')
https://t.co/5VGUc18KVU",False,False,https://twitter.com/python_tip/status/1285484781850038272,"[{'url': 'https://t.co/E7HjHdAma5', 'expanded_url': 'http://gdd.download', 'display_url': 'gdd.download'}, {'url': 'https://t.co/5VGUc18KVU', 'expanded_url': 'https://stackoverflow.com/a/47761459', 'display_url': 'stackoverflow.com/a/47761459'}]",[]
1285319487055691776,2020-07-20 21:03:40+00:00,33,10,"#pythontip by @verosk:
'randomcolor' is a Python port of a library for generating attractive random colors. https://t.co/MKzz7YNUu3
Link to the original JS library with examples:
https://t.co/wreNqk61ye https://t.co/pidyWt6awx",False,False,https://twitter.com/python_tip/status/1285319487055691776,"[{'url': 'https://t.co/MKzz7YNUu3', 'expanded_url': 'https://github.com/kevinwuhoo/randomcolor-py', 'display_url': 'github.com/kevinwuhoo/ran…'}, {'url': 'https://t.co/wreNqk61ye', 'expanded_url': 'https://github.com/davidmerfield/randomColor', 'display_url': 'github.com/davidmerfield/…'}]","[{'url': 'https://t.co/pidyWt6awx', 'media_url': 'http://pbs.twimg.com/media/EdZfJnRWkAA_u9H.png', 'display_url': 'pic.twitter.com/pidyWt6awx'}]"
1284114089975918594,2020-07-17 13:13:51+00:00,88,26,"Trying to print() a large nested structure?
pretty-print will look better.
https://t.co/dzFJQLErQG
#python
>>> import requests
>>> from pprint import pprint
>>> url = 'https://t.co/3kfWu2Eq3H'
>>> res = requests.get(url).json()
>>> pprint(res) https://t.co/K2CZVOICvK",False,False,https://twitter.com/python_tip/status/1284114089975918594,"[{'url': 'https://t.co/dzFJQLErQG', 'expanded_url': 'https://docs.python.org/3/library/pprint.html', 'display_url': 'docs.python.org/3/library/ppri…'}, {'url': 'https://t.co/3kfWu2Eq3H', 'expanded_url': 'https://www.ebi.ac.uk/mi/impc/solr/statistical-result/select?q=marker_symbol:Car4', 'display_url': 'ebi.ac.uk/mi/impc/solr/s…'}]","[{'url': 'https://t.co/K2CZVOICvK', 'media_url': 'http://pbs.twimg.com/media/EdIWxUhX0AAdA1k.png', 'display_url': 'pic.twitter.com/K2CZVOICvK'}]"
1283759556284252162,2020-07-16 13:45:03+00:00,94,19,"Parse #pandas dataframe to #markdown:
>>> df = pd.DataFrame({'a': [1, 2], 'b': ['x', 'y']})
>>> https://t.co/yGT52QVczk_markdown()
'| | a | b |\n|---:|----:|:----|\n| 0 | 1 | x |\n| 1 | 2 | y |' https://t.co/GWoOzGGPAL",False,False,https://twitter.com/python_tip/status/1283759556284252162,"[{'url': 'https://t.co/yGT52QVczk', 'expanded_url': 'http://df.to', 'display_url': 'df.to'}]","[{'url': 'https://t.co/GWoOzGGPAL', 'media_url': 'http://pbs.twimg.com/media/EdDUd5-WkAE5lqM.png', 'display_url': 'pic.twitter.com/GWoOzGGPAL'}]"
1283323069013131269,2020-07-15 08:50:37+00:00,111,19,"frequency count:
>>> from collections import Counter
>>> a = 'dfjkdfjkaaabckdjfoe'
>>> Counter(a)
Counter({'d': 3, 'f': 3, 'j': 3, 'k': 3, 'a': 3, 'b': 1, 'c': 1, 'o': 1, 'e': 1})
#python",False,False,https://twitter.com/python_tip/status/1283323069013131269,[],[]
1282962835765694464,2020-07-14 08:59:11+00:00,102,31,"for loops may have an else clause - it is executed after the loop completes normally, but not when the loop is terminated by a break statement.
for item in items:
if something(item):
do_st(item)
break
else:
print(""Not found."")
https://t.co/sVf67lSdCL",False,False,https://twitter.com/python_tip/status/1282962835765694464,"[{'url': 'https://t.co/sVf67lSdCL', 'expanded_url': 'https://docs.python.org/3/tutorial/controlflow.html#break-and-continue-statements-and-else-clauses-on-loops', 'display_url': 'docs.python.org/3/tutorial/con…'}]",[]
1281507897571250176,2020-07-10 08:37:46+00:00,0,0,"RT @abhi_bops: @python_tip In cases where there are duplicate items, I find enumerate very helpful
>>> a = ['car', 'bike', 'scooter', 'bike…",False,True,https://twitter.com/python_tip/status/1281507897571250176,[],[]
1281467437154807810,2020-07-10 05:57:00+00:00,90,11,"Finding the index of an item in a list:
>>> a = ['car', 'bike', 'scooter']
>>> a.index('bike')
1",False,False,https://twitter.com/python_tip/status/1281467437154807810,[],[]
1281350573057609728,2020-07-09 22:12:37+00:00,15,7,"Q: quick and dirty debugging
https://t.co/xmwiRL9WOk
All output goes to /tmp/q
To print the value of foo, insert this into your program:
import q; q(foo)
To trace a function’s arguments and return value, insert this above the def:
import q
@q",False,False,https://twitter.com/python_tip/status/1281350573057609728,"[{'url': 'https://t.co/xmwiRL9WOk', 'expanded_url': 'https://pypi.org/project/q/', 'display_url': 'pypi.org/project/q/'}]",[]
1281349237100486656,2020-07-09 22:07:19+00:00,0,0,@mhlkong The syntax is similar. More comparisons at https://t.co/o64fciCLap,True,False,https://twitter.com/python_tip/status/1281349237100486656,"[{'url': 'https://t.co/o64fciCLap', 'expanded_url': 'https://fastapi.tiangolo.com/alternatives/', 'display_url': 'fastapi.tiangolo.com/alternatives/'}]",[]
1280743164869931009,2020-07-08 05:59:00+00:00,46,10,"A bit crazy but creative #pythontip by Błażej Michalik:
def ________________________________________():
print('─' * 80)
The function above can make your print-heavy script a bit more readable (also the output).",False,False,https://twitter.com/python_tip/status/1280743164869931009,[],[]
1280380021891268608,2020-07-07 05:56:00+00:00,66,9,"For #pandas series indexed by time, you can subset by the hour https://t.co/SxmZXpqvri",False,False,https://twitter.com/python_tip/status/1280380021891268608,[],"[{'url': 'https://t.co/SxmZXpqvri', 'media_url': 'http://pbs.twimg.com/media/Ebzdz7ZWsAA0lo-.png', 'display_url': 'pic.twitter.com/SxmZXpqvri'}]"
1280018643632324609,2020-07-06 06:00:00+00:00,135,21,"FastAPI = web framework for building APIs in Python 3.6+
* type hints
* automatic interactive API documentation
* asynchronous
https://t.co/tzy1yf7dNY https://t.co/2XTJU6iVnG",False,False,https://twitter.com/python_tip/status/1280018643632324609,"[{'url': 'https://t.co/tzy1yf7dNY', 'expanded_url': 'https://fastapi.tiangolo.com/#example', 'display_url': 'fastapi.tiangolo.com/#example'}]","[{'url': 'https://t.co/2XTJU6iVnG', 'media_url': 'http://pbs.twimg.com/media/EbzcBWAXYAcOM84.jpg', 'display_url': 'pic.twitter.com/2XTJU6iVnG'}]"
1279133055526019074,2020-07-03 19:21:00+00:00,22,5,"f = 2
𝑓 = 42
print(f)
42
Explanation: https://t.co/4YDVJFRa4C",False,False,https://twitter.com/python_tip/status/1279133055526019074,"[{'url': 'https://t.co/4YDVJFRa4C', 'expanded_url': 'https://stackoverflow.com/a/62256274', 'display_url': 'stackoverflow.com/a/62256274'}]",[]
1278934937803141120,2020-07-03 06:13:45+00:00,96,15,"You can sort using a tuple as a key:
scores = [{'score': 20, 'id':11}, {'score': 1, 'id': 10}, {'score': 20, 'id': 3}]
print(sorted(scores, key=lambda k: (k['score'], k['id'])))
[{'score': 1, 'id': 10}, {'score': 20, 'id': 3}, {'score': 20, 'id': 11}]
#Python",False,False,https://twitter.com/python_tip/status/1278934937803141120,[],[]
1278388902345224192,2020-07-01 18:04:00+00:00,259,43,">>> import calendar
>>> print(calendar.month(2020, 7)) https://t.co/XQTc4mNtgJ",False,False,https://twitter.com/python_tip/status/1278388902345224192,[],"[{'url': 'https://t.co/XQTc4mNtgJ', 'media_url': 'http://pbs.twimg.com/media/Eb0Wl0cWAAE-8F2.png', 'display_url': 'pic.twitter.com/XQTc4mNtgJ'}]"
1278198251284508672,2020-07-01 05:26:25+00:00,202,38,"zip magic
>>> a = ['a', 'b', 'c']
>>> b = [1, 2, 3]
>>> c = list(zip(a,b))
>>> c
[('a', 1), ('b', 2), ('c', 3)]
>>> list(zip(*c))
[('a', 'b', 'c'), (1, 2, 3)]
>>> dict(zip(a, b))
{'a': 1, 'b': 2, 'c': 3}
#python",False,False,https://twitter.com/python_tip/status/1278198251284508672,[],[]
1277713248750575619,2020-06-29 21:19:11+00:00,89,25,"slicing in #python:
s[start:end]
s[start:end:step]
>>> lst = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> lst[2:4]
[2, 3]
>>> lst[8:2:-1]
[8, 7, 6, 5, 4, 3]
>>> lst[1:8:2]
[1, 3, 5, 7]
>>> lst[:-2:3]
[0, 3, 6]
>>> lst[::-2]
[9, 7, 5, 3, 1]",False,False,https://twitter.com/python_tip/status/1277713248750575619,[],[]
1276394258707210240,2020-06-26 05:58:00+00:00,24,4,"Resample/groupby #pandas time-series data:
https://t.co/32BRPt0iJL https://t.co/DJS6BpSGtF",False,False,https://twitter.com/python_tip/status/1276394258707210240,"[{'url': 'https://t.co/32BRPt0iJL', 'expanded_url': 'https://www.kaggle.com/python10pm/pandas-100-tricks#Trick-27:-Aggregation-over-timeseries-(resample)', 'display_url': 'kaggle.com/python10pm/pan…'}]","[{'url': 'https://t.co/DJS6BpSGtF', 'media_url': 'http://pbs.twimg.com/media/EbH6faAUwAIrz7W.png', 'display_url': 'pic.twitter.com/DJS6BpSGtF'}]"
1276035394400706560,2020-06-25 06:12:00+00:00,252,44,"Zip is its own inverse!
a = (1, 2, 3, 4)
b = (5, 6, 7, 8)
ab_zip = zip(a, b)
# ab_zip = [(1, 5), (2, 6), (3, 7), (4, 8)]
zip(*ab_zip)
# returns [(1, 2, 3, 4), (5, 6, 7, 8)] https://t.co/tTGUM5d0eT",False,False,https://twitter.com/python_tip/status/1276035394400706560,[],"[{'url': 'https://t.co/tTGUM5d0eT', 'media_url': 'http://pbs.twimg.com/media/EbJCQV6WoAgaeKN.png', 'display_url': 'pic.twitter.com/tTGUM5d0eT'}]"
1275669988284784642,2020-06-24 06:00:00+00:00,94,32,"Did you know you can now use plotly/bokeh backends for #pandas (interactive) plots?
E.g. just set
pd.options.plotting.backend = ""plotly""
https://t.co/g3QvHfW28a",False,False,https://twitter.com/python_tip/status/1275669988284784642,"[{'url': 'https://t.co/g3QvHfW28a', 'expanded_url': 'https://towardsdatascience.com/plotting-in-pandas-just-got-prettier-289d0e0fe5c0', 'display_url': 'towardsdatascience.com/plotting-in-pa…'}]",[]
1275424368168800256,2020-06-23 13:44:00+00:00,87,22,"Importing functions from a local file is easy, just
>>> import file
But what if the file is not in the same folder/subfolder? This is the workaround:
>>> import sys
>>> sys.path.insert(1, '/path/to/the/file')
>>> import file
Details at
https://t.co/P1j5Xyhne5 https://t.co/EhU4pBye4a",False,False,https://twitter.com/python_tip/status/1275424368168800256,"[{'url': 'https://t.co/P1j5Xyhne5', 'expanded_url': 'https://stackoverflow.com/questions/4383571/importing-files-from-different-folder', 'display_url': 'stackoverflow.com/questions/4383…'}]","[{'url': 'https://t.co/EhU4pBye4a', 'media_url': 'http://pbs.twimg.com/media/EbHpGWvU8AAKRDS.png', 'display_url': 'pic.twitter.com/EhU4pBye4a'}]"
1275053451488215041,2020-06-22 13:10:06+00:00,54,17,"Do you need to do statistics in Python? Are statmodels / scipy.stats too much / not enough at the same time? Try pingouin!
https://t.co/dUi8Ij96ob
Several examples here 👇👇
https://t.co/reV9rd8FTG https://t.co/YkYitMkfeo",False,False,https://twitter.com/python_tip/status/1275053451488215041,"[{'url': 'https://t.co/dUi8Ij96ob', 'expanded_url': 'https://pingouin-stats.org/index.html', 'display_url': 'pingouin-stats.org/index.html'}, {'url': 'https://t.co/reV9rd8FTG', 'expanded_url': 'https://towardsdatascience.com/new-python-library-for-statistical-tests-simpler-than-statsmodels-richer-than-scipy-stats-ff380d4673c0', 'display_url': 'towardsdatascience.com/new-python-lib…'}]","[{'url': 'https://t.co/YkYitMkfeo', 'media_url': 'http://pbs.twimg.com/media/EbHmNqcWsAIsl28.png', 'display_url': 'pic.twitter.com/YkYitMkfeo'}]"
1274052075589074946,2020-06-19 18:51:00+00:00,16,5,"Common plots in #python, comparison of different modules:
https://t.co/Rle7Sfm1Ys",False,False,https://twitter.com/python_tip/status/1274052075589074946,"[{'url': 'https://t.co/Rle7Sfm1Ys', 'expanded_url': 'https://pythonplot.com/#scatter-plot-with-colors', 'display_url': 'pythonplot.com/#scatter-plot-…'}]",[]
1273849068079452160,2020-06-19 05:24:19+00:00,44,10,"Open a page using the default web browser:
>>> import webbrowser
>>> https://t.co/JZLG2SaDuI('https://t.co/hqu0Ad9e8j')
True
#Python",False,False,https://twitter.com/python_tip/status/1273849068079452160,"[{'url': 'https://t.co/JZLG2SaDuI', 'expanded_url': 'http://webbrowser.open', 'display_url': 'webbrowser.open'}]",[]
1273182387703296001,2020-06-17 09:15:10+00:00,9,4,"Guess the results:
>>> import numpy as np
>>> import pandas as pd
>>> np.nan == np.nan
>>> https://t.co/kKksLTtTy3 == https://t.co/kKksLTtTy3
#pandas #numpy",False,False,https://twitter.com/python_tip/status/1273182387703296001,"[{'url': 'https://t.co/kKksLTtTy3', 'expanded_url': 'http://pd.NA', 'display_url': 'pd.NA'}, {'url': 'https://t.co/kKksLTtTy3', 'expanded_url': 'http://pd.NA', 'display_url': 'pd.NA'}]",[]
1272625742417997824,2020-06-15 20:23:15+00:00,123,24,"str.startswith() accepts also a tuple of prefixes to look for:
>>> ""somestring"".startswith((""aa"", ""xx"", ""z"", ""som""))
True
#python
https://t.co/0bM41Fb5p3",False,False,https://twitter.com/python_tip/status/1272625742417997824,"[{'url': 'https://t.co/0bM41Fb5p3', 'expanded_url': 'https://docs.python.org/3/library/stdtypes.html#str.startswith', 'display_url': 'docs.python.org/3/library/stdt…'}]",[]
1271575758448680960,2020-06-12 22:51:00+00:00,60,9,"Get signature of a function with inspect.signature
Example: use argument only if it is in the signature
https://t.co/wN0NzX3Fzf https://t.co/RT3iFEItcj",False,False,https://twitter.com/python_tip/status/1271575758448680960,"[{'url': 'https://t.co/wN0NzX3Fzf', 'expanded_url': 'https://gist.github.com/simecek/346683b38627f95075eb940e6d753ba2', 'display_url': 'gist.github.com/simecek/346683…'}]","[{'url': 'https://t.co/RT3iFEItcj', 'media_url': 'http://pbs.twimg.com/media/EaRUIuiXgAE31ut.jpg', 'display_url': 'pic.twitter.com/RT3iFEItcj'}]"
1271214668506431488,2020-06-11 22:56:09+00:00,61,14,"tqdm() gives you a progress bar for any iterable. But what about pd.Series.apply function? Use pd.Series.progress_apply instead.
Example:
df = pd.DataFrame(range(1000), columns=['numbers'])
df.numbers.progress_apply(lambda x: x**2)
https://t.co/4HYWggzcxh",False,False,https://twitter.com/python_tip/status/1271214668506431488,"[{'url': 'https://t.co/4HYWggzcxh', 'expanded_url': 'https://colab.research.google.com/gist/simecek/f3a30b2b4cd590c31e35f0e4e1fb3462/untitled1.ipynb', 'display_url': 'colab.research.google.com/gist/simecek/f…'}]",[]
1270847614066601986,2020-06-10 22:37:37+00:00,48,16,"Create Python (or R) dashboards directly inside Google Sheets
https://t.co/ZjSwGqqR9J",False,False,https://twitter.com/python_tip/status/1270847614066601986,"[{'url': 'https://t.co/ZjSwGqqR9J', 'expanded_url': 'https://towardsdatascience.com/using-r-and-python-in-google-sheets-formulas-b397b302098', 'display_url': 'towardsdatascience.com/using-r-and-py…'}]",[]
1270423845195911169,2020-06-09 18:33:42+00:00,19,4,"#pythontip by @cpwood:
https://t.co/6woqgz9Bam is a quick way to test the endpoint of a #Flask or #Django webapp -- why write tests for every endpoint when you can have a spider do it for you?",False,False,https://twitter.com/python_tip/status/1270423845195911169,"[{'url': 'https://t.co/6woqgz9Bam', 'expanded_url': 'https://github.com/python-testing-crawler/python-testing-crawler', 'display_url': 'github.com/python-testing…'}]",[]
1270138613817151488,2020-06-08 23:40:18+00:00,52,9,"#pandas pd.describe_option(opt_name) prints the description for `opt_name` option.
Most common pandas display options:
* max_rows
* max_columns
* width
* precision
https://t.co/1RLO6Qdupl https://t.co/GNQhp9TDOL",False,False,https://twitter.com/python_tip/status/1270138613817151488,"[{'url': 'https://t.co/1RLO6Qdupl', 'expanded_url': 'https://www.kaggle.com/python10pm/pandas-100-tricks#Trick-33:-Pandas-display-options', 'display_url': 'kaggle.com/python10pm/pan…'}]","[{'url': 'https://t.co/GNQhp9TDOL', 'media_url': 'http://pbs.twimg.com/media/EaBvcZ2XQAUE01I.png', 'display_url': 'pic.twitter.com/GNQhp9TDOL'}]"
1269103468041682951,2020-06-06 03:07:00+00:00,42,7,"Practical Python Programming - a course by @dabeaz, under CC license. Enjoy!
https://t.co/Yijk640ajY",False,False,https://twitter.com/python_tip/status/1269103468041682951,"[{'url': 'https://t.co/Yijk640ajY', 'expanded_url': 'https://dabeaz-course.github.io/practical-python/', 'display_url': 'dabeaz-course.github.io/practical-pyth…'}]",[]
1268919215295209472,2020-06-05 14:54:50+00:00,77,18,"#pythontip by @1adityajoshi
Use f-strings for string formatting:
lives = ""Black""
print(f""{lives} lives matter"")
>> ""Black lives matter""
As opposed to
lives = ""Black""
print(f""{lives} lives matter"".format(lives))
>> ""Black lives matter""",False,False,https://twitter.com/python_tip/status/1268919215295209472,[],[]
1268168638047100930,2020-06-03 13:12:19+00:00,103,36,"If you are new to #python and #github, you can follow @github's introduction and intermediate tutorials.
https://t.co/5g2eLrsNa6
https://t.co/Yrv6aGOxKs",False,False,https://twitter.com/python_tip/status/1268168638047100930,"[{'url': 'https://t.co/5g2eLrsNa6', 'expanded_url': 'https://lab.github.com/everydeveloper/introduction-to-python', 'display_url': 'lab.github.com/everydeveloper…'}, {'url': 'https://t.co/Yrv6aGOxKs', 'expanded_url': 'https://lab.github.com/everydeveloper/intermediate-python', 'display_url': 'lab.github.com/everydeveloper…'}]",[]
1267808435015266304,2020-06-02 13:21:00+00:00,16,3,"Writing blog post in #Jupyter notebooks? (Almost) no problem for Pelican and the pelican-jupyter plugin.
https://t.co/ehzsNaWiYD",False,False,https://twitter.com/python_tip/status/1267808435015266304,"[{'url': 'https://t.co/ehzsNaWiYD', 'expanded_url': 'https://github.com/danielfrg/pelican-jupyter', 'display_url': 'github.com/danielfrg/peli…'}]",[]
1267432434422996993,2020-06-01 12:26:54+00:00,51,9,"Do you need fake data for your project? Names, addresses or text? Try Faker.
https://t.co/QitcjcHld8",False,False,https://twitter.com/python_tip/status/1267432434422996993,"[{'url': 'https://t.co/QitcjcHld8', 'expanded_url': 'https://github.com/joke2k/faker', 'display_url': 'github.com/joke2k/faker'}]",[]
1266243372378804225,2020-05-29 05:42:00+00:00,42,11,"OpenStreetMaps (OSM) are an incredible resource of information. Here is a colab with an example how to mine for specif points of interest (e.g. mexican restaurant in S.F.) using #OSMnx and plot the result on #folium map.
https://t.co/Rw2gkXuzDM https://t.co/zXpaMWuzdA",False,False,https://twitter.com/python_tip/status/1266243372378804225,"[{'url': 'https://t.co/Rw2gkXuzDM', 'expanded_url': 'https://colab.research.google.com/gist/simecek/fd0eca9fcf29c1816887c10a18d4d5b7/osmnx-example.ipynb', 'display_url': 'colab.research.google.com/gist/simecek/f…'}]","[{'url': 'https://t.co/zXpaMWuzdA', 'media_url': 'http://pbs.twimg.com/media/EY0qGWJXQAUEYwx.jpg', 'display_url': 'pic.twitter.com/zXpaMWuzdA'}]"
1265885513929691143,2020-05-28 06:00:00+00:00,37,18,"Do you feel that #pandas sometimes need complicated statements for a basic stuff?
Have a look at #siuba, a Python port of #rstats #dplyr library:
https://t.co/zBfeH6nEnQ https://t.co/ogVCiNouVn",False,False,https://twitter.com/python_tip/status/1265885513929691143,"[{'url': 'https://t.co/zBfeH6nEnQ', 'expanded_url': 'https://github.com/machow/siuba', 'display_url': 'github.com/machow/siuba'}, {'url': 'https://t.co/ogVCiNouVn', 'expanded_url': 'https://twitter.com/vboykis/status/1256576336254074883', 'display_url': 'twitter.com/vboykis/status…'}]",[]
1265523126718222336,2020-05-27 06:00:00+00:00,84,26,"ipywidgets = interactive HTML widgets for Jupyter notebooks (JN)
voilà = JNs turned into web applications
binder = run JN in a reproducible way online
ipywidgets + voilà + binder = turn your JN into a web app accessible for anybody
Example: https://t.co/INx50UE8Uv",False,False,https://twitter.com/python_tip/status/1265523126718222336,"[{'url': 'https://t.co/INx50UE8Uv', 'expanded_url': 'https://github.com/voila-gallery/gaussian-density', 'display_url': 'github.com/voila-gallery/…'}]",[]
1265159228328566784,2020-05-26 05:54:00+00:00,40,10,"Cool hack from @raymondh: you can use a dictionary for __slots__ of your class to document the attributes.
If you have never heard about __slots__, read the whole thread. https://t.co/I6VoX9oQbo",False,False,https://twitter.com/python_tip/status/1265159228328566784,"[{'url': 'https://t.co/I6VoX9oQbo', 'expanded_url': 'https://twitter.com/raymondh/status/1255230102754951173', 'display_url': 'twitter.com/raymondh/statu…'}]",[]
1264794827163447296,2020-05-25 05:46:00+00:00,119,21,"#pandas Split a string column into multiple columns with Series.str.split(..., expand = True)
Example: 👇👇
https://t.co/5ujM9kDFRd https://t.co/ldGtFby6Xs",False,False,https://twitter.com/python_tip/status/1264794827163447296,"[{'url': 'https://t.co/5ujM9kDFRd', 'expanded_url': 'https://www.kaggle.com/python10pm/pandas-100-tricks#Trick-21:-Split-a-string-column-into-multiple-columns', 'display_url': 'kaggle.com/python10pm/pan…'}]","[{'url': 'https://t.co/ldGtFby6Xs', 'media_url': 'http://pbs.twimg.com/media/EYz0DZaXQAAVc5L.jpg', 'display_url': 'pic.twitter.com/ldGtFby6Xs'}]"
1263788523590684676,2020-05-22 11:07:18+00:00,73,11,">>> s = ""Große""
>>> s.upper()
'GROSSE'
>>> s.lower()
'große'
>>> s.casefold()
'grosse'",False,False,https://twitter.com/python_tip/status/1263788523590684676,[],[]
1262973579181817856,2020-05-20 05:09:00+00:00,147,28,#Jupyter notebook magic %history gives you a list of all the commands run in the notebook. https://t.co/Uwy5s8d64V,False,False,https://twitter.com/python_tip/status/1262973579181817856,[],"[{'url': 'https://t.co/Uwy5s8d64V', 'media_url': 'http://pbs.twimg.com/media/EYb7m1zXQAImXPP.jpg', 'display_url': 'pic.twitter.com/Uwy5s8d64V'}]"
1262964183550877697,2020-05-20 04:31:40+00:00,0,0,"RT @eumiro: @jonaro00 @python_tip One of the mañanas contains one character ""\N{latin small letter n with tilde}"", another one two characte…",False,True,https://twitter.com/python_tip/status/1262964183550877697,[],[]
1262725016153661440,2020-05-19 12:41:18+00:00,62,15,"Normalize, normalize,... and normalize.
>>> 'mañana' == 'mañana'
False
>>> from unicodedata import normalize
>>> normalize('NFC', 'mañana') == normalize('NFC', 'mañana')
True
>>>",False,False,https://twitter.com/python_tip/status/1262725016153661440,[],[]
1261567058539511808,2020-05-16 08:00:00+00:00,134,32,"Simple animations with #celluloid. Just call camera.snap() after each plot
fig = plt.figure()
camera = https://t.co/O2fo1IwBR6(fig)
t = np.linspace(0, 2*np.pi, 128, endpoint=False)
for i in t:
plt.plot(t, np.sin(t+i), color='blue')
camera.snap()
https://t.co/ZuB4oUiGFo https://t.co/CFHUctSw7a",False,False,https://twitter.com/python_tip/status/1261567058539511808,"[{'url': 'https://t.co/O2fo1IwBR6', 'expanded_url': 'http://celluloid.Camera', 'display_url': 'celluloid.Camera'}, {'url': 'https://t.co/ZuB4oUiGFo', 'expanded_url': 'https://github.com/jwkvam/celluloid/', 'display_url': 'github.com/jwkvam/cellulo…'}]","[{'url': 'https://t.co/CFHUctSw7a', 'media_url': 'http://pbs.twimg.com/ext_tw_video_thumb/1261379229729595394/pu/img/MFvI3fwjx9kvMv-b.jpg', 'display_url': 'pic.twitter.com/CFHUctSw7a'}]"
1261365933999681537,2020-05-15 18:40:48+00:00,10,2,"#pythontip by @psincraian:
View download stats of python packages at https://t.co/C0hnDMOhEA",False,False,https://twitter.com/python_tip/status/1261365933999681537,"[{'url': 'https://t.co/C0hnDMOhEA', 'expanded_url': 'https://pepy.tech/', 'display_url': 'pepy.tech'}]",[]
1261044134057476097,2020-05-14 21:22:05+00:00,33,10,"List unpacking is faster than indexing 👇👇
Thanks, @sponsfreixes.
More discussion at
https://t.co/PAPELdhSEz https://t.co/oxcFE3Mo2G",False,False,https://twitter.com/python_tip/status/1261044134057476097,"[{'url': 'https://t.co/PAPELdhSEz', 'expanded_url': 'https://stackoverflow.com/questions/13024416/how-come-unpacking-is-faster-than-accessing-by-index', 'display_url': 'stackoverflow.com/questions/1302…'}, {'url': 'https://t.co/oxcFE3Mo2G', 'expanded_url': 'https://twitter.com/sponsfreixes/status/1260969323163615235', 'display_url': 'twitter.com/sponsfreixes/s…'}]",[]
1260365737715253249,2020-05-13 00:26:22+00:00,36,2,"Use #folium to create interactive maps.
It works even in Colab 👇
https://t.co/VmlEZyLxEe
You can save your map into a static web page with
your_map.save(outfile= ""my_map_page.html"") https://t.co/pVsTdNjqij",False,False,https://twitter.com/python_tip/status/1260365737715253249,"[{'url': 'https://t.co/VmlEZyLxEe', 'expanded_url': 'https://colab.research.google.com/gist/simecek/32f934aa2ad2b6442fb634f38b846066/folium_demo.ipynb', 'display_url': 'colab.research.google.com/gist/simecek/3…'}]","[{'url': 'https://t.co/pVsTdNjqij', 'media_url': 'http://pbs.twimg.com/media/EX23BvgXkAE5xSP.png', 'display_url': 'pic.twitter.com/pVsTdNjqij'}]"
1259981022252408835,2020-05-11 22:57:39+00:00,114,36,"#Pandas https://t.co/ZTlyyXqxn1 enables you to
a) hide index (hide_index)
b) set caption (set_caption)
c) formatting and highlighting of columns (format, highlight_min, highlight_max, background_gradient)
For examples, see
https://t.co/zLX99Kb8FP https://t.co/aU2r0nFxIN",False,False,https://twitter.com/python_tip/status/1259981022252408835,"[{'url': 'https://t.co/ZTlyyXqxn1', 'expanded_url': 'http://DataFrame.style', 'display_url': 'DataFrame.style'}, {'url': 'https://t.co/zLX99Kb8FP', 'expanded_url': 'https://towardsdatascience.com/style-pandas-dataframe-like-a-master-6b02bf6468b0', 'display_url': 'towardsdatascience.com/style-pandas-d…'}]","[{'url': 'https://t.co/aU2r0nFxIN', 'media_url': 'http://pbs.twimg.com/media/EXxZ2csWkAIZQuL.png', 'display_url': 'pic.twitter.com/aU2r0nFxIN'}]"
1258886266055266306,2020-05-08 22:27:29+00:00,109,33,"Rich: #Python library for rendering rich text and beautiful formatting to the terminal. Compatible with Linux, OSX and Windows. Version 1.0 just released.
https://t.co/f9C2D4MpCv",False,False,https://twitter.com/python_tip/status/1258886266055266306,"[{'url': 'https://t.co/f9C2D4MpCv', 'expanded_url': 'https://github.com/willmcgugan/rich', 'display_url': 'github.com/willmcgugan/ri…'}]",[]
1258297158207451136,2020-05-07 07:26:35+00:00,81,19,"Do you need something like range() but with float numbers? Try numpy.arange()
>>> range(0, 5, 0.5) #Error!
>>> np.arange(0, 5, 0.5)
array([0. , 0.5, 1. , 1.5, 2. , 2.5, 3. , 3.5, 4. , 4.5])
#numpy",False,False,https://twitter.com/python_tip/status/1258297158207451136,[],[]
1257804376829308928,2020-05-05 22:48:26+00:00,51,6,"If the local date format us DD/MM/YYYY, you can use the dayfirst=True argument in dateutil.parser.parse:
>>> from dateutil.parser import parse
>>> s = '6.5.2020'
>>> parse(s)
datetime.datetime(2020, 6, 5, 0, 0)
>>> parse(s, dayfirst=True)
datetime.datetime(2020, 5, 6, 0, 0)",False,False,https://twitter.com/python_tip/status/1257804376829308928,[],[]
1257645833174028290,2020-05-05 12:18:27+00:00,66,12,"Apart of converting strings to lowercase or uppercase, you can use the swapcase() method.
>>> s = 'Python is aWeSome.'
>>> s.upper()
'PYTHON IS AWESOME.'
>>> s.lower()
'python is awesome.'
>>> s.swapcase()
'pYTHON IS AwEsOME.'
https://t.co/wFce5kNyF9
#Python",False,False,https://twitter.com/python_tip/status/1257645833174028290,"[{'url': 'https://t.co/wFce5kNyF9', 'expanded_url': 'https://docs.python.org/3/library/stdtypes.html#str.swapcase', 'display_url': 'docs.python.org/3/library/stdt…'}]",[]
1256227258689294337,2020-05-01 14:21:32+00:00,32,11,"mkdir test
echo ""print('Hello world!')"" > test/__main__.py
zip -j https://t.co/4nNyHnUmpT test/*
python https://t.co/4nNyHnUmpT
Note, it can further improved
https://t.co/WMYlPGATSP
(also note, this opens Pandora's box of security vulnerabilities) https://t.co/KcMMiVmAAw",False,False,https://twitter.com/python_tip/status/1256227258689294337,"[{'url': 'https://t.co/4nNyHnUmpT', 'expanded_url': 'http://test.zip', 'display_url': 'test.zip'}, {'url': 'https://t.co/4nNyHnUmpT', 'expanded_url': 'http://test.zip', 'display_url': 'test.zip'}, {'url': 'https://t.co/WMYlPGATSP', 'expanded_url': 'https://stackoverflow.com/a/19543959', 'display_url': 'stackoverflow.com/a/19543959'}, {'url': 'https://t.co/KcMMiVmAAw', 'expanded_url': 'https://twitter.com/indiecom/status/1255555099088338946', 'display_url': 'twitter.com/indiecom/statu…'}]",[]
1255981809814441984,2020-04-30 22:06:13+00:00,79,15,"Use `subplots=True` to plot columns of #pandas DataFrame into separate subfigures (and `subplots=False` to combine them into one figure).
Example: 👇👇
https://t.co/jC6KjzAQez https://t.co/L1TPfaQjXC",False,False,https://twitter.com/python_tip/status/1255981809814441984,"[{'url': 'https://t.co/jC6KjzAQez', 'expanded_url': 'https://gist.github.com/simecek/7aa4bbfafdb5df4e21f4581b5843c69c', 'display_url': 'gist.github.com/simecek/7aa4bb…'}]","[{'url': 'https://t.co/L1TPfaQjXC', 'media_url': 'http://pbs.twimg.com/media/EW4fjmMXgAIPByH.png', 'display_url': 'pic.twitter.com/L1TPfaQjXC'}]"
1255376267928571905,2020-04-29 06:00:00+00:00,68,13,"Interpolate missing values in your series with pd.Series.interpolate.
Example: 👇👇 https://t.co/9Zp5efRa8k",False,False,https://twitter.com/python_tip/status/1255376267928571905,[],"[{'url': 'https://t.co/9Zp5efRa8k', 'media_url': 'http://pbs.twimg.com/media/EWkPms4WsAEOzCv.png', 'display_url': 'pic.twitter.com/9Zp5efRa8k'}]"
1255013374653587456,2020-04-28 05:58:00+00:00,48,18,"Find Errors Faster and Write Simpler Functions with Sonarlint
- identify uncalled code
- security risks
- cognitive complexity
More info: weapon #3 at
https://t.co/9e8pIXbDoj
VS code extension:
https://t.co/a6UsoEnhwx",False,False,https://twitter.com/python_tip/status/1255013374653587456,"[{'url': 'https://t.co/9e8pIXbDoj', 'expanded_url': 'https://towardsdatascience.com/the-3-secret-weapons-that-changed-my-python-editor-forever-c99f7b2e0084', 'display_url': 'towardsdatascience.com/the-3-secret-w…'}, {'url': 'https://t.co/a6UsoEnhwx', 'expanded_url': 'https://www.sonarlint.org/vscode/', 'display_url': 'sonarlint.org/vscode/'}]",[]
1254733346908901381,2020-04-27 11:25:16+00:00,111,55,"Thanks, Springer, for releasing many Python/ML/DS books for free:
https://t.co/p3PcoWmIRQ
Including...
Data Structures and Algorithms with Python, https://t.co/zzbeTudBF1
Python Programming Fundamentals, https://t.co/Ca5sUwyWVG
Python For ArcGIS, https://t.co/0UsuDYmYN8",False,False,https://twitter.com/python_tip/status/1254733346908901381,"[{'url': 'https://t.co/p3PcoWmIRQ', 'expanded_url': 'https://towardsdatascience.com/springer-has-released-65-machine-learning-and-data-books-for-free-961f8181f189', 'display_url': 'towardsdatascience.com/springer-has-r…'}, {'url': 'https://t.co/zzbeTudBF1', 'expanded_url': 'https://link.springer.com/book/10.1007/978-3-319-13072-9', 'display_url': 'link.springer.com/book/10.1007/9…'}, {'url': 'https://t.co/Ca5sUwyWVG', 'expanded_url': 'https://link.springer.com/book/10.1007/978-1-4471-6642-9', 'display_url': 'link.springer.com/book/10.1007/9…'}, {'url': 'https://t.co/0UsuDYmYN8', 'expanded_url': 'https://link.springer.com/book/10.1007/978-3-319-18398-5', 'display_url': 'link.springer.com/book/10.1007/9…'}]",[]
1254651491152953347,2020-04-27 06:00:00+00:00,22,5,"Do you want to avoid problems with math.nan? Use #numpy!
> np.sort([5., math.nan, 10., 0.])
array([ 0., 5., 10., nan])
> np.sort([math.nan, 1.])
array([ 1., nan])
> sorted([1., math.nan])
array([ 1., nan])
> np.max([3., math.nan, 1.])
nan
> np.nanmax([3., math.nan, 1.])
3.0 https://t.co/d3HKD31aw9",False,False,https://twitter.com/python_tip/status/1254651491152953347,"[{'url': 'https://t.co/d3HKD31aw9', 'expanded_url': 'https://twitter.com/python_tip/status/1253646874306924545', 'display_url': 'twitter.com/python_tip/sta…'}]",[]
1253646874306924545,2020-04-24 11:28:01+00:00,54,11,"Beware of nan!
😱#python
>>> sorted([5.0, math.nan, 10.0, 0.0])
[5.0, nan, 0.0, 10.0]
>>> sorted([math.nan, 1.0])
[nan, 1.0]
>>> sorted([1.0, math.nan])
[1.0, nan]
>>> min(3, math.nan, 1)
1
>>> min(math.nan, 3, 1)
nan
#pythontip by @raymondh",False,False,https://twitter.com/python_tip/status/1253646874306924545,[],[]
1253236187906572288,2020-04-23 08:16:05+00:00,44,14,"None is evaluated as False so you can write
>>> results = None
>>> print(results or ""No results"")
Use case:
def query(q, connection=None):
conn = connection or create_connection()
c = conn.cursor()
...
#python_tip by @IDryer and @Pythonic_",False,False,https://twitter.com/python_tip/status/1253236187906572288,[],[]
1252720331350999041,2020-04-21 22:06:16+00:00,31,11,"#pydoc is a fantastic tool for viewing documentation of #python libraries.
Link: https://t.co/iKKKP0EFkv
Usage
$ pydoc numpy.array
or
$ pydoc -p 1234 # browse to localhost:1234
#pythontip by @mmngreco",False,False,https://twitter.com/python_tip/status/1252720331350999041,"[{'url': 'https://t.co/iKKKP0EFkv', 'expanded_url': 'https://docs.python.org/3/library/pydoc.html', 'display_url': 'docs.python.org/3/library/pydo…'}]",[]
1252371754581803008,2020-04-20 23:01:08+00:00,47,27,"Have you tried PyCaret?
An open source, low-code #MachineLearning library. Share your experience with us.
https://t.co/GisEOQk7XX",False,False,https://twitter.com/python_tip/status/1252371754581803008,"[{'url': 'https://t.co/GisEOQk7XX', 'expanded_url': 'https://towardsdatascience.com/announcing-pycaret-an-open-source-low-code-machine-learning-library-in-python-4a1f1aad8d46', 'display_url': 'towardsdatascience.com/announcing-pyc…'}]",[]
1251533428098555904,2020-04-18 15:29:56+00:00,84,17,"Get 1% random sample of a huge CSV file (+ other 99 #pandas tricks):
df = https://t.co/KBWVZaKP7L_csv(""YOUR_BIG_FILE.csv"", skiprows = lambda x: x>0 and np.random.rand() > 0.01)
https://t.co/iiDCjk3oOX",False,False,https://twitter.com/python_tip/status/1251533428098555904,"[{'url': 'https://t.co/KBWVZaKP7L', 'expanded_url': 'http://pd.read', 'display_url': 'pd.read'}, {'url': 'https://t.co/iiDCjk3oOX', 'expanded_url': 'https://www.kaggle.com/python10pm/pandas-100-tricks#Trick-100:-Loading-sample-of-big-data', 'display_url': 'kaggle.com/python10pm/pan…'}]",[]
1251305436441202691,2020-04-18 00:23:58+00:00,19,8,"PyConUS is taking place right now. Read intro https://t.co/TOBhLLNnV1 & subscribe to YT channel https://t.co/1myy0jozdW
Still hungry? Come to Remote Python 🍕https://t.co/9bX4QTZmON
Or join us at ""Optimization for ML: From Theory to Practice and Back"" https://t.co/lqDnHEn7Sw https://t.co/jg6oULh1OZ",False,False,https://twitter.com/python_tip/status/1251305436441202691,"[{'url': 'https://t.co/TOBhLLNnV1', 'expanded_url': 'https://us.pycon.org/2020/online/', 'display_url': 'us.pycon.org/2020/online/'}, {'url': 'https://t.co/1myy0jozdW', 'expanded_url': 'https://www.youtube.com/c/PyCon2020', 'display_url': 'youtube.com/c/PyCon2020'}, {'url': 'https://t.co/9bX4QTZmON', 'expanded_url': 'https://remote.python.pizza/', 'display_url': 'remote.python.pizza'}, {'url': 'https://t.co/lqDnHEn7Sw', 'expanded_url': 'https://www.meetup.com/Machine-Learning-Meetup-Brno/events/270062275/', 'display_url': 'meetup.com/Machine-Learni…'}]","[{'url': 'https://t.co/jg6oULh1OZ', 'media_url': 'http://pbs.twimg.com/media/EV2Hm-AWoAEGbgf.jpg', 'display_url': 'pic.twitter.com/jg6oULh1OZ'}]"
1250737136149692417,2020-04-16 10:45:45+00:00,31,8,"#pythontip by @RashmikaNawa:
How to increase speed when iterating over rows in a DataFrame? Use `itertuples()` instead of `iterrows()`.
Also, consider vectorization or `apply()` instead.
More info:
https://t.co/4irSUKz3Eh
#pandas #performance https://t.co/exaEnelqq4",False,False,https://twitter.com/python_tip/status/1250737136149692417,"[{'url': 'https://t.co/4irSUKz3Eh', 'expanded_url': 'https://stackoverflow.com/questions/16476924/how-to-iterate-over-rows-in-a-dataframe-in-pandas', 'display_url': 'stackoverflow.com/questions/1647…'}, {'url': 'https://t.co/exaEnelqq4', 'expanded_url': 'https://twitter.com/RashmikaNawa/status/1250599237529657346', 'display_url': 'twitter.com/RashmikaNawa/s…'}]",[]
1250557581560623108,2020-04-15 22:52:16+00:00,26,6,"Cookiecutter template for a data science project
https://t.co/L98dKi25ox",False,False,https://twitter.com/python_tip/status/1250557581560623108,"[{'url': 'https://t.co/L98dKi25ox', 'expanded_url': 'https://github.com/drivendata/cookiecutter-data-science', 'display_url': 'github.com/drivendata/coo…'}]",[]
1250198338152128514,2020-04-14 23:04:46+00:00,107,20,"Use `parse` package as an alternative to string parsing with regular expressions. In short, parse() is the opposite of format().
https://t.co/lUQObe6umZ
Examples: 👇👇 https://t.co/Z7Sh4jQyoz",False,False,https://twitter.com/python_tip/status/1250198338152128514,"[{'url': 'https://t.co/lUQObe6umZ', 'expanded_url': 'https://pypi.org/project/parse/', 'display_url': 'pypi.org/project/parse/'}]","[{'url': 'https://t.co/Z7Sh4jQyoz', 'media_url': 'http://pbs.twimg.com/media/EVmYwAVXYAQr1NC.png', 'display_url': 'pic.twitter.com/Z7Sh4jQyoz'}]"
1250048761314902017,2020-04-14 13:10:24+00:00,2,2,Which one do you prefer?,False,False,https://twitter.com/python_tip/status/1250048761314902017,[],[]
1250048286293196800,2020-04-14 13:08:30+00:00,54,7,"It has been three years since we posted the first #pythontip.
To celebrate, we decided to come with a new logo. Please, help us choosing from two candidates: https://t.co/Qp81qcS6tY",False,False,https://twitter.com/python_tip/status/1250048286293196800,[],"[{'url': 'https://t.co/Qp81qcS6tY', 'media_url': 'http://pbs.twimg.com/media/EVkP8DrX0AANWHz.jpg', 'display_url': 'pic.twitter.com/Qp81qcS6tY'}]"
1249818468859498498,2020-04-13 21:55:18+00:00,33,16,"Create geographical scatter plots with #python and #plotly (plotly.graph_objects.Scattergeo or https://t.co/7rUbsWonBC.scatter_geo)
https://t.co/spmqGLbvBJ
Example:
https://t.co/imdEPvX6ut
#dataviz",False,False,https://twitter.com/python_tip/status/1249818468859498498,"[{'url': 'https://t.co/7rUbsWonBC', 'expanded_url': 'http://plotly.express', 'display_url': 'plotly.express'}, {'url': 'https://t.co/spmqGLbvBJ', 'expanded_url': 'https://plotly.com/python/scatter-plots-on-maps/', 'display_url': 'plotly.com/python/scatter…'}, {'url': 'https://t.co/imdEPvX6ut', 'expanded_url': 'https://www.geodose.com/2020/02/tracking-coronavirus-python-map.html', 'display_url': 'geodose.com/2020/02/tracki…'}]",[]
1248357517832437762,2020-04-09 21:10:00+00:00,42,9,"Remove a file in #python #pathlib:
from pathlib import Path
file_path = Path('/path/to/myfile.xyz')