Skip to content

Instantly share code, notes, and snippets.

View jrovegno's full-sized avatar

jrovegno jrovegno

View GitHub Profile
@jrovegno
jrovegno / examples.py
Created March 10, 2018 14:22
Append rows to DataFrame
import pandas as pd
# Append correlative row from dict
df = pd.DataFrame(columns=['a','b','c'])
df = df.append(pd.Series({'a': 1, 'b': 2}), ignore_index=True)
df = df.append(pd.Series({'a': 4, 'c': 6}), ignore_index=True)
print('Append correlative row from dict\n', df)
# Append row from dict with defined index
df.loc[3] = pd.Series({'a': 1, 'b': 2, 'c': 3})
@jrovegno
jrovegno / suma.py
Created February 8, 2018 21:32
Pregunta de stvzito en python-es
from io import StringIO
import pandas as pd
DATA="""id,target,valores
1,100,20
1,100,30
1,100,50
1,100,15
1,100,45
@jrovegno
jrovegno / delicious2csv.py
Last active January 7, 2016 15:48
Parses a delicious.com bookmark file and transforms it into a list of dictionaries.
#!/usr/bin/env python
#coding:utf-8
# Author: --<>
# Purpose:
# Created: 12/29/10
from HTMLParser import HTMLParser # Python 2
import pandas as pd
# from html.parser import HTMLParser # Python 3
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jrovegno
jrovegno / dga_01.rb
Last active December 18, 2015 18:42
Reparado problema con dialogo descarga excel
require 'webdrone'
profile = Selenium::WebDriver::Firefox::Profile.new
profile['startup.homepage_welcome_url.additional'] = 'about:blank'
profile['browser.helperApps.neverAsk.saveToDisk'] = 'images/jpeg, application/pdf, application/octet-stream, application/download, application/vnd.ms-excel'
a0 = Webdrone.create browser: :firefox, timeout: 10, firefox_profile: profile
def entrar_dga(a0)
a0.open.url 'http://dgasatel.mop.cl/'
@jrovegno
jrovegno / README.md
Last active August 29, 2015 13:59
IPSA - README is empty

README is empty

@jrovegno
jrovegno / colebrook.py
Created June 26, 2012 21:50
Efficient Resolution of the Colebrook Equation
from math import log
def vel(q, a):
"""
Mean Velocity (q[m3/s], a[m2])
q is flow rate
a is cross-sectional area
"""
return q / a
@jrovegno
jrovegno / hamming.py
Created June 14, 2012 18:42
Desafío 2012-06 El problema de Hamming
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# hamming.py
#
# Copyright 2012 Javier Rovegno Campos <javier.rovegno@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
@jrovegno
jrovegno / std-2.py
Created May 14, 2012 15:54
standard deviation of the values
import numpy as np
f = open('numeros.txt', 'r')
numbers = f.readlines()
f.close()
i = 0
for num in numbers:
numbers[i] = float(num)
i += 1
@jrovegno
jrovegno / std-1.py
Created May 14, 2012 15:34
standard deviation of the values
from math import sqrt
sum, sum2, n = 0.0, 0.0, 0.0
f = open('numeros.txt', 'r')
numbers = f.readlines()
f.close()
for num in numbers:
k = float(num)
sum += k