Python Pandas does not read the first row of csv file

By default, pd.read_csv uses header=0 (when the names parameter is also not specified) which means the first (i.e. 0th-indexed) line is interpreted as column names. If your data has no header, then use pd.read_csv(…, header=None) For example, import io import sys import pandas as pd if sys.version_info.major == 3: # Python3 StringIO = io.StringIO else: … Read more

Load script from groovy script

If you don’t mind the code in file2 being in a with block, you can do: new GroovyShell().parse( new File( ‘file1.groovy’ ) ).with { method() } Another possible method would be to change file1.groovy to: class File1 { def method() { println “test” } } And then in file2.groovy you can use mixin to add … Read more

ERROR 2068 (HY000): LOAD DATA LOCAL INFILE file request rejected due to restrictions on access

Using MySql Workbench 8 or above introduced this issue. This fixed it for me: This restriction can be removed from MySQL Workbench 8.0 in the following way. Edit the connection, on the Connection tab, go to the ‘Advanced’ sub-tab, and in the ‘Others:’ box add the line ‘OPT_LOCAL_INFILE=1’. This should allow a client using the … Read more

Can I load external stylesheets on request?

Yup: if you create a <link> tag linking to a stylesheet and add it to the <head> tag, the browser will load that stylesheet. E.g. $(‘head’).append(‘<link rel=”stylesheet” type=”text/css” href=”https://stackoverflow.com/questions/2126238/lightbox_stylesheet.css”>’); However, as per @peteorpeter’s comments, this doesn’t work in IE 8 or under — there, you need to either: append the <link> before setting its href; … Read more

Load package dynamically

No, Go doesn’t support dynamically loaded libraries. Your best bet is to start the plugin as its own executable and communicate with it through sockets or via stdin/stdout. 2017 update This answer is no longer true, Go now supports plugins (for Linux and MacOS only as of June 2021)

How do you dynamically compile and load external java classes? [duplicate]

Take a look at JavaCompiler The following is based on the example given in the JavaDocs This will save a File in the testcompile directory (based on the package name requirements) and the compile the File to a Java class… package inlinecompiler; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.Writer; import java.net.URL; import java.net.URLClassLoader; import … Read more

jquery callback after all images in dom are loaded?

Use the load()(docs) method against the window. $(window).load(function() { // this will fire after the entire page is loaded, including images }); Note: On newer jQuery versions use $(window).on(‘load’, function(){ …}); Or just do it directly via window.onload . window.onload = function() { // this will fire after the entire page is loaded, including images … Read more

Fade in each element – one after another

Let’s say you have an array of span elements: $(“span”).each(function(index) { $(this).delay(400*index).fadeIn(300); }); (quick note: I think you need jQuery 1.4 or higher to use the .delay method) This would basically wait a set amount of time and fade each element in. This works because you’re multiplying the time to wait by the index of … Read more