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
5629
votes
62 answers

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

Is there something in JavaScript similar to @import in CSS that allows you to include a JavaScript file inside another JavaScript file?
Alec Smart
  • 85,672
  • 35
  • 115
  • 178
2307
votes
52 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
  • 33,621
  • 35
  • 108
  • 193
1078
votes
25 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
  • 217,272
  • 324
  • 727
  • 1,038
971
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
905
votes
11 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…
TonyGW
  • 15,511
  • 38
  • 93
  • 165
633
votes
17 answers

Call a function from another file?

Set_up: I have a .py file for each function I need to use in a program. In this program, I need to call the function from the external files. I've tried: from file.py import function(a,b) But I get the error: ImportError: No module named…
user2977230
  • 6,993
  • 4
  • 12
  • 8
561
votes
35 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
527
votes
11 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,595
  • 3
  • 17
  • 11
473
votes
17 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
  • 5,968
  • 8
  • 23
  • 18
439
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,628
  • 3
  • 11
  • 11
424
votes
14 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
  • 7,699
  • 8
  • 30
  • 51
415
votes
7 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
  • 30,291
  • 37
  • 89
  • 120
397
votes
19 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
  • 55,858
  • 96
  • 259
  • 471
392
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
  • 12,814
  • 4
  • 34
  • 48
322
votes
5 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
  • 3,549
  • 5
  • 17
  • 25
1
2 3
99 100