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).

27281 questions
6246
votes
71 answers

How do I include a JavaScript file in another JavaScript file?

How do I include a JavaScript file inside another JavaScript file, similar to @import in CSS?
Alec Smart
  • 94,115
  • 39
  • 120
  • 184
2717
votes
55 answers

How do I import an SQL file using the command line in MySQL?

I have a .sql file with an export from phpMyAdmin. I want to import it into a different server using the command line. I have a Windows Server 2008 R2 installation. I placed the .sql file on the C drive, and I tried this command database_name <…
Jaylen
  • 39,043
  • 40
  • 128
  • 221
1668
votes
12 answers

Relative imports for the billionth time

I've been here: http://www.python.org/dev/peps/pep-0328/ http://docs.python.org/2/tutorial/modules.html#packages Python packages: relative imports python relative import example code does not work Relative imports in python 2.5 Relative imports in…
user1881400
1212
votes
28 answers

In Node.js, how do I "include" functions from my other files?

Let's say I have a file called app.js. Pretty simple: var express = require('express'); var app = express.createServer(); app.set('views', __dirname + '/views'); app.set('view engine', 'ejs'); app.get('/', function(req, res){ res.render('index',…
TIMEX
  • 259,804
  • 351
  • 777
  • 1,080
1125
votes
12 answers

When should I use curly braces for ES6 import?

It seems to be obvious, but I found myself a bit confused about when to use curly braces for importing a single module in ES6. For example, in the React-Native project I am working on, I have the following file and its content: File…
TonyW
  • 18,375
  • 42
  • 110
  • 183
787
votes
19 answers

How do I call a function from another .py file?

file.py contains a function named function. How do I import it? from file.py import function(a,b) The above gives an error: ImportError: No module named 'file.py'; file is not a package
user2977230
  • 8,897
  • 5
  • 14
  • 9
617
votes
37 answers

Stop Excel from automatically converting certain text values to dates

Does anyone happen to know if there is a token I can add to my csv for a certain field so Excel doesn't try to convert it to a date? I'm trying to write a .csv file from my application and one of the values happens to look enough like a date that…
user16324
580
votes
15 answers

beyond top level package error in relative import

It seems there are already quite some questions here about relative import in python 3, but after going through many of them I still didn't find the answer for my issue. so here is the question. I have a package shown below package/ …
shelper
  • 10,053
  • 8
  • 41
  • 67
572
votes
18 answers

Why is using a wild card with a Java import statement bad?

It is much more convenient and cleaner to use a single statement like import java.awt.*; than to import a bunch of individual classes import java.awt.Panel; import java.awt.Graphics; import java.awt.Canvas; ... What is wrong with using a wildcard…
jnancheta
  • 7,008
  • 8
  • 25
  • 18
561
votes
12 answers

Quickly reading very large tables as dataframes

I have very large tables (30 million rows) that I would like to load as a dataframes in R. read.table() has a lot of convenient features, but it seems like there is a lot of logic in the implementation that would slow things down. In my case, I am…
eytan
  • 5,945
  • 3
  • 20
  • 11
556
votes
8 answers

The difference between "require(x)" and "import x"

I've just started working on a small node project that will interface with a MongoDB. However, I cannot seem to get the relevant node modules to import correctly, even though I have installed them correctly via npm. For example, the following code…
austinthemassive
  • 5,907
  • 6
  • 21
  • 25
525
votes
9 answers

Change Name of Import in Java, or import two classes with the same name

In Python you can do a: from a import b as c How would you do this in Java, as I have two imports that are clashing.
Federer
  • 33,677
  • 39
  • 93
  • 121
460
votes
6 answers

@import vs #import - iOS 7

I am playing around with some of the new iOS 7 features and working with some of the Image Effects as discussed in the WWDC video "Implementing Engaging UI on iOS". For producing a blur effect within the source code for the session, UIImage was…
jamdaddy25
  • 4,838
  • 3
  • 13
  • 11
432
votes
21 answers

How can I import a database with MySQL from terminal?

How can I import a database with mysql from terminal? I cannot find the exact syntax.
aneuryzm
  • 63,052
  • 100
  • 273
  • 488
406
votes
10 answers

What is the difference between #import and #include in Objective-C?

What are the differences between #import and #include in Objective-C and are there times where you should use one over the other? Is one deprecated? I was reading the following tutorial: http://www.otierney.net/objective-c.html#preamble and its…
Ryan Guill
  • 13,558
  • 4
  • 37
  • 48
1
2 3
99 100