Spyder complains about some basic commands

zkurtz

Here is some code that runs with no problem:

enter image description here

When I hover over the warning triangles, Spyder tells me that datetime and vstack are "undefined". But they seem to be defined, since the code runs. How can I make those warning triangles go away?

Copy-able code here:

# -*- coding: utf-8 -*-
#%%
import numpy as np
x = np.array([0, 1, 2])
this_year = datetime.date.today().year
y = vstack((x,x))
#%%
Padraic Cunningham
import datetime and use np.vstack

You have not imported the datetime module and vstack is part of numpy which you imported as np.

I don't see how the code could run without importing datetime and using np.vstack.

Typing the commands into ipython gives NameError: name 'datetime' is not defined:

In [3]: import numpy as np

In [4]: x = np.array([0,1,2])

In [5]: this_year = datetime.date.today().year
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-5-a5c59948ea66> in <module>()
----> 1 this_year = datetime.date.today().year

NameError: name 'datetime' is not defined

your code runs because I think there is a site-packages/spyderlib/scientific_startup.py that imports modules automatically, numpy is included as must datetime.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Spyder complains about some basic commands

From Dev

A very basic setting issue about spyder and anaconda for python

From Dev

A very basic setting issue about spyder and anaconda for python

From Dev

Some basic questions about Processor and OS?

From Dev

Some basic questions about OOP in JS

From Dev

PHPUnit complains about Selenium

From Dev

PHPUnit complains about Selenium

From Dev

Gradle complains about bracket

From Dev

fltk complains about gcc on windows

From Dev

Linker complains about missing -fPIC

From Dev

Some basic questions about JIT-Compiler and installation

From Dev

I have some basic questions about jmeter anybody can?

From Dev

Some basic questions about JWT (server and client side)

From Dev

Xcode complains about Unused functions that are used

From Dev

split now complains about missing "isSeparator"

From Dev

embedFonts complains about “Unknown device: pswrite”

From Dev

Aida Web install complains about missing "SecureHashAlgorithm"

From Dev

GHC complains about overlapping instances when in fact they are not

From Dev

PyCharm complains about patch.object but why?

From Dev

ggplot complains about applying code to the data

From Dev

Juicy Pixels complains about not having enough memory

From Dev

Doxygen complains about recursive C++ class

From Dev

Stringer tool complains about wrong archive header

From Dev

Why Netbeans complains about "incorrect credentials" with Git?

From Dev

Tuple struct constructor complains about private fields

From Dev

ESlint Airbnb Config Complains about Quotes

From Dev

Sonar complains about Spring Boot configuration

From Dev

Jacoco complains about unlikely missing branch coverage

From Dev

Pylint complains about comparing a string to a literal with 'is'

Related Related

  1. 1

    Spyder complains about some basic commands

  2. 2

    A very basic setting issue about spyder and anaconda for python

  3. 3

    A very basic setting issue about spyder and anaconda for python

  4. 4

    Some basic questions about Processor and OS?

  5. 5

    Some basic questions about OOP in JS

  6. 6

    PHPUnit complains about Selenium

  7. 7

    PHPUnit complains about Selenium

  8. 8

    Gradle complains about bracket

  9. 9

    fltk complains about gcc on windows

  10. 10

    Linker complains about missing -fPIC

  11. 11

    Some basic questions about JIT-Compiler and installation

  12. 12

    I have some basic questions about jmeter anybody can?

  13. 13

    Some basic questions about JWT (server and client side)

  14. 14

    Xcode complains about Unused functions that are used

  15. 15

    split now complains about missing "isSeparator"

  16. 16

    embedFonts complains about “Unknown device: pswrite”

  17. 17

    Aida Web install complains about missing "SecureHashAlgorithm"

  18. 18

    GHC complains about overlapping instances when in fact they are not

  19. 19

    PyCharm complains about patch.object but why?

  20. 20

    ggplot complains about applying code to the data

  21. 21

    Juicy Pixels complains about not having enough memory

  22. 22

    Doxygen complains about recursive C++ class

  23. 23

    Stringer tool complains about wrong archive header

  24. 24

    Why Netbeans complains about "incorrect credentials" with Git?

  25. 25

    Tuple struct constructor complains about private fields

  26. 26

    ESlint Airbnb Config Complains about Quotes

  27. 27

    Sonar complains about Spring Boot configuration

  28. 28

    Jacoco complains about unlikely missing branch coverage

  29. 29

    Pylint complains about comparing a string to a literal with 'is'

HotTag

Archive