Questions tagged [python-3.6]

Version of the Python programming language released in December 2016. For issues specific to Python 3.6. Use more generic [python] and [python-3.x] tags where possible.

Python 3.6 is the currently newest version of the popular Python programming language (see PEP 0494).

Use this tag if your question is specifically related to Python 3.6. Otherwise, use the following guidelines to determine which tag(s) you should add to your question:

  • If your question applies to Python in general, use only the tag.
  • If your question applies to Python 3.x but not to Python 2.x, add the tag .
  • If you aren't sure, tag your question with and mention which version you're using in the post.

References

5657 questions
19
votes
2 answers

Python Pandas: TypeError: unsupported operand type(s) for +: 'datetime.time' and 'Timedelta'

I am attempting to add two series in a dataframe in pandas with the first series being a 24-hr time value (e.g. 17:30) exported from an excel file and the second series being a series of the same length in Timedelta format converted from floats with…
DoctorWhom
  • 219
  • 1
  • 2
  • 7
19
votes
1 answer

MyPy: what is the type of a requests object?

I'm trying to use Python 3's type hinting syntax, along with the MyPy static type checker. I'm now writing a function that takes a requests response object, and I'm wondering how to indicate the type. That is to say, in the following piece of code,…
Newb
  • 2,810
  • 3
  • 21
  • 35
19
votes
3 answers

What are formatted string literals in Python 3.6?

One of the features of Python 3.6 are formatted strings. This SO question(String with 'f' prefix in python-3.6) is asking about the internals of formatted string literals, but I don't understand the exact use case of formatted string literals. In…
Günther Jena
  • 3,706
  • 3
  • 34
  • 49
18
votes
3 answers

Installing python-ldap fails with lber.h file not found in ubuntu 17.10 even after installing devel packages

I am trying to install python-ldap package using pip. I am getting the below error while executing pip install python-ldap. I tried installing the package corresponding to ubuntu 17.10 ( Artful ) as per this question but no luck yet. What package am…
Bill Goldberg
  • 1,699
  • 5
  • 26
  • 50
18
votes
3 answers

Create an abstract Enum class

I'm trying to create an abstract enum (Flag actually) with an abstract method. My final goal is to be able to create a string representation of compound enums, based on the basic enums I defined. I'm able to get this functionality without making the…
Tzahi T
  • 346
  • 3
  • 11
18
votes
3 answers

Trying to update libpython3.6-stdlib results in overwrite error

Here are the error logs which I get try to update the dependency. I feel --overwrite flag can do the job with "dpkg" but I am not sure whether to use it or not as I see some cross dependency down there. Thank you so much for your help. sudo apt-get…
vipulbhj
  • 710
  • 5
  • 21
18
votes
2 answers

How to create image from a list of pixel values in Python3?

If I have a list of pixel rows from an image in the following format, how would get the image? [ [(54, 54, 54), (232, 23, 93), (71, 71, 71), (168, 167, 167)], [(204, 82, 122), (54, 54, 54), (168, 167, 167), (232, 23, 93)], [(71, 71, 71),…
Gray
  • 373
  • 1
  • 3
  • 10
18
votes
3 answers

Duck typing with python 3.5 style type-annotations

Supposing I have a function with a signature like: def foo(self, name:str, stream): pass I want to add an annotation to the "stream" argument so which means "you can have any object x as long as x.readline()->str". So that means I could use any…
Salim Fadhley
  • 6,975
  • 14
  • 46
  • 83
18
votes
2 answers

Anaconda: any way to indicate if dependency issues prevent "conda update"ing the *absolute* latest version of a module?

I recently discovered my numpy installation (MacOS, with anaconda) was on an old version 1.11.x, instead of the latest 1.12.0, when a function documented on their website was not found. When I would type conda update numpy, I would be told the…
Luke Davis
  • 2,548
  • 2
  • 21
  • 43
17
votes
1 answer

RuntimeError: empty_like method already has a docstring

I am working on a project that was developed using python 3.6 and I am using python 3.7 instead. I tried to run the tests that passed. However in the end I got a series of errors like this one: Error in atexit._run_exitfuncs: Traceback (most recent…
amarchin
  • 2,044
  • 1
  • 16
  • 32
17
votes
2 answers

Is it possible to lineplot more than 6 columns with seaborn?

Is it possible to plot more than 6 columns using seaborn.lineplot? When I try to plot it I receive following error message: These `style` levels are missing dashes: {'LOGAN', 'HB20S', 'GOL'} It works if I index the dataframe for 6 columns. Here's…
Rafael
  • 181
  • 1
  • 1
  • 6
17
votes
2 answers

python3 -Get result from async method

I have written a simple scraping program using asyncio. Here are my code snippets: loop = asyncio.get_event_loop() task = loop.create_task(conSpi.parse(arguments.url)) value = loop.run_until_complete(asyncio.wait([task])) loop.close() I want to…
Afraz Ahmad
  • 386
  • 1
  • 5
  • 20
17
votes
4 answers

Representation of all values in Flag enum

I would like to have a "ALL" flag in my python Flags enum for which myenum.EVERY_MEMBER & myenum.ALL == myenum.EVERY_MEMBER holds true. I currently have: from enum import Flag, auto class RefreshFlags(Flag): NONE = 0 EVENTS = auto() …
Sekuraz
  • 548
  • 3
  • 15
17
votes
5 answers

How to interpolate a list into an f-string in Python?

Say I have a function def foo(): return [1, 2, 3] I want to interpolate the result of the function into a string to get "001 002 003". I've tried this: f"{*foo():03d 03d 03d}" But it produced SyntaxError: can't use starred expression here. Can I…
planetp
  • 14,248
  • 20
  • 86
  • 160
16
votes
2 answers

pandas dataframe multiline query

Say I have a dataframe import numpy as np import pandas as pd df = pd.DataFrame(np.random.randint(10, size=(10,3)), columns=['a', 'b', 'c']) if I now try to query it using the query method: this works: df.query('''a > 3 and b < 9''') this throws…
gioxc88
  • 503
  • 3
  • 18