Posts avec #PythonTip

#PythonTip

Les posts publics sur X qui utilisent #PythonTip.

Hashtags associés

  1. Daily Python Tip 🐍🐧@python_tip
    Use beautiful_date when need to create date/datetime objects in a simple way. pip install beautiful-date from beautiful_date import * >>> d = 5/Mar/2019 BeautifulDate(2019, 3, 5) >>> d[4:13] datetime.datetime(2019, 3, 5, 4, 13) #pythontip from @KuzmovychBox
    21469
  2. Daily Python Tip 🐍🐧@python_tip
    Does your #numpy array contain missing values? > import numpy as np > x = np.array([1,2,3,np.nan]) You can remove them: > x[~np.isnan(x)] array([ 1., 2., 3.]) > np.nanmean(x) 2.0 Or replace them by a number: > np.nan_to_num(x,0) array([ 1., 2., 3., 0.]) #pythontip
    21245
  3. Daily Python Tip 🐍🐧@python_tip
    #Python Best Practices for a 🆕 Project in 2021: pyenv, poetry, VS code, pytest, pytest-cov, pre-commit, flake8, black, mypy, isort Thanks, @Eli_Krumova, for this #pythontip. Do you want to contribute a tip? Send it to or just mention us in your tweet.
    Sourabh Singh Katoch @SourabhSKatoch
    21531
  4. Daily Python Tip 🐍🐧@python_tip
    One more way to combine a list of lists into a single set: >>> lol = [['a', 'b', 'c'], ['b', 'c', 'd'], ['d', 'e']] >>> set().union(*lol) set(['a', 'c', 'b', 'e', 'd']) #pythontip from @raymondh
    01941
  5. Daily Python Tip 🐍🐧@python_tip
    zip() is its own inverse (via @jakevdp): >>> data = [(1, 2, 3), ('a', 'b', 'c')] >>> zipped = zip(*data) >>> zipped [(1, 'a'), (2, 'b'), (3, 'c')] >>> unzipped = zip(*zipped) >>> unzipped [(1, 2, 3), ('a', 'b', 'c')] #pythontip #zip
    036109
  6. Mike Driscoll✓@driscollis
    🐍 #PythonTip: Use list comprehensions for concise and readable one-liners. Example: `[x**2 for x in range(10) if x%2 == 0]` #CodeClean
    64417.6K
  7. Bas Steins✓@bascodes
    💡🐍 Python is a popular language for connecting different data sources. Use a 𝙲𝚑𝚊𝚒𝚗𝙼𝚊𝚙 to get a singular value from a collection of different 𝚍𝚒𝚌𝚝s: #tweet100 #pythontip
    Télécharger
    615109
  8. Daily Python Tip 🐍🐧@python_tip
    Did you know that there is an else clause in Python's `for` loops letting you check if the loop encountered a `break`? Example: 👇👇 #pythontip by @bascodes
    Télécharger
    Bas Steins @bascodes
    Did you know that there is an else clause in Python's `for` loops letting you check if the loop encountered a `break`? #pythontip
    1128
  9. Bas Steins✓@bascodes
    Did you know that there is an else clause in Python's `for` loops letting you check if the loop encountered a `break`? #pythontip
    Télécharger
    017
  10. Daily Python Tip 🐍🐧@python_tip
    Working with a large DataFrame, that is too slow to load/write with read_csv/to_csv? Try read_hdf/to_hdf or read_parquet/to_parquet (For more info: #pythontip #pandas
    0946
  11. Daily Python Tip 🐍🐧@python_tip
    You can name your slices: >>> record = "01234567890123456789I want this0123456789" >>> IWANT = slice(20,31) >>> record[IWANT] 'I want this' #python #pythontip
    12559
  12. pystar@pystar
    #PythonTip Use `itertools.count` to generate a range of floats pretty similar to how you can use `range(start, stop, step)` to generate a range of integers.
    Télécharger
    3851
  13. Afficher plus de posts