Questions tagged [import]

The general process of moving data from an external source into one's platform, program, or data set.

Used as a general term to mean "bringing data from outside, in." It often involves modifying, converting, or truncating data to fit within the constraints of the system into which it is being moved, to translate the format of the current data into one which is more easily used by the target system, or to cut a large data set down to only data that is relevant to the person performing the import process.

In Python, the import statement is used to access objects defined in the standard library, as well as external modules and packages. Python imports are actual statements that are executed in runtime. It is possible to import a specific part of the module by using from <module> import <specific_part>. It is also possible to rename the imported object by using as.

In Java, the import statement is used to import class names from another package. In recent versions of the language, the static import statement is used to import names of static members of a specific class; i.e. static fields or methods. Unlike Python, Java imports are processed at compile time, being actually syntactic sugar (so one does not need to specify fully qualified names throughout the code).

23357 questions
6
votes
1 answer

When bundling JavaScript with Webpack, what does the @ symbol mean at the beginning of the require/import URL?

I'm using Webpack to bundle my JavaScript application. I saw a developer during a talk that had a line similar to this: var foo = require('@/foo/bar'); OR import '@/foo/bar'; What does the @ symbol mean in this case? A co-worker thought that it…
Jeremy Sullivan
  • 985
  • 1
  • 14
  • 25
6
votes
1 answer

Why do imports fail in setuptools entry_point scripts, but not in python interpreter?

I have the following project structure: project |-project.py |-__init__.py |-setup.py |-lib |-__init__.py |-project |-__init__.py |-tools.py with project.py: from project.lib import * def main(): print("main") tool() if…
Karl Richter
  • 6,271
  • 17
  • 57
  • 120
6
votes
1 answer

Using multiprocessing in Python, what is the correct approach for import statements?

PEP 8 states: Imports are always put at the top of the file, just after any module comments and docstrings, and before module globals and constants. However if the class/method/function that I am importing is only used by a child process, surely…
Andrés Marafioti
  • 628
  • 1
  • 6
  • 17
6
votes
1 answer

Can't seem to import scikit-learn's MLPRegressor

So I'm trying to use scikit-learn's MLPRegressor, but python keeps spitting back an ImportError: No module named MLPRegressor. I'm currently trying to use the syntax from sklearn.neural_network import MLPRegressor. I've uninstalled and reinstalled…
podington
  • 159
  • 1
  • 8
6
votes
2 answers

How to run Odoo ORM methods in the python console?

I would like to use ORM methods such as browse or search in the python console. $pwd /opt/odoo/ $python >>> import openerp >>> product_obj = pool.get('product.product) Traceback (most recent call last): File "", line 1, in…
m3asmi
  • 1,221
  • 1
  • 14
  • 31
6
votes
3 answers

How to import CSV files into Firebase

I see we can import json files into firebase. What I would like to know is if there is a way to import CSV files (I have files that could have about 50K or even more records with about 10 columns). Does it even make sense to have such files in…
Poorani
  • 61
  • 1
  • 1
  • 3
6
votes
1 answer

Python Import Star Creating Hidden Namespace?

I recently ran into some unusual behavior. foo.py a = 0 def bar(): print (a) Console: >>> import foo >>> foo.bar() 0 >>> foo.a = 10 >>> foo.bar() 10 Console: >>> from foo import * >>> bar() 0 >>> a 0 >>> a = 10 >>> a 10 >>> bar() 0 I'm…
user65
  • 783
  • 1
  • 6
  • 10
6
votes
1 answer

Confused by Coq imports

Can someone please tell me the differences between Require Name. Require Import Name. Import Name ?
Cryptostasis
  • 1,084
  • 6
  • 14
6
votes
2 answers

use an external library in pyspark job in a Spark cluster from google-dataproc

I have a spark cluster I created via google dataproc. I want to be able to use the csv library from databricks (see https://github.com/databricks/spark-csv). So I first tested it like this: I started a ssh session with the master node of my cluster,…
sweeeeeet
  • 1,599
  • 2
  • 19
  • 45
6
votes
1 answer

Importing remote files via ES6 import

I have an ES6 React app thats being compiled and bundled via browserify. I have several import statements like: import React from 'react/addons' I also need to use an external library that creates an HTML widget, hosted on a CDN. I've tried…
Allyl Isocyanate
  • 12,435
  • 15
  • 71
  • 117
6
votes
2 answers

Reading an RDS file within a zip file without extracting to disk

Is there a reason I can't read a RDS file from within a zip file directly, without having to unzip it to a temp file on disk first? Let's say this is the zip file: saveRDS(cars, "cars.rds") saveRDS(iris, "iris.rds") write.csv(iris,…
cocquemas
  • 1,099
  • 8
  • 16
6
votes
2 answers

Want to save & run Python script in Jupyter Notebook (Anaconda)

Another python newbie here. Currently, I'm using Jupypter notebook in anaconda framework. In order to proceed my projects using iPython Notebook, I need to run some of my python scripts (tp.py file) on the notebook. from tp import wordtoplural …
SUNDONG
  • 1,733
  • 3
  • 15
  • 33
6
votes
3 answers

Jsoup Import Errors

I'm looking to do some web crawling/scraping and I did some research and discovered Jsoup. The only problem I'm having is with the imports. The videos I've watched and examples I've seen have all had matching code to mine but for whatever reason…
user3536685
  • 117
  • 1
  • 4
6
votes
1 answer

autoupdate module in IPython / jupyter notebook

I wrote my own module which as the following structure: mymodule/ ├── __init__.py ├── part1.py ├── part2.py ├── part3.py └── part4.py To test my module I am using IPython and/or jupyter notebook (formerly Ipython Notebook). As usual I do the module…
albert
  • 6,188
  • 6
  • 37
  • 71
6
votes
0 answers

IPython loading R - ImportError: cannot import name conversion

I'm trying to work in R from Ipython but i get this error when load the rmagic >> rpy2.ipython (now) library: (I've only copied the final, not all code) /usr/lib/python2.7/dist-packages/rpy2/robjects/robject.py in () 5…
Aida Palacio Hoz
  • 241
  • 1
  • 2
  • 7
1 2 3
99
100