Aquesta és una revisió antiga del document


Python Pandas

  • pip3 install pandas
  • soporte para excel:
    pip3.9 install openpyxl # needed to load Excel .xlsx files
    pip3.9 install xlrd # needed to load Excel old .xls files)
# segundo bokeh plot con pandas
from bokeh.plotting import figure
from bokeh.io import output_file, show
import pandas
 
df=pandas.read_csv("https://pythonizing.github.io/data/bachelors.csv")
 
x=df["Year"]
y=df["Engineering"]
 
output_file("Line.html")
 
f=figure()
f.line(x,y)
 
show(f)
import pandas
 
from bokeh.plotting import figure, output_file, show
 
df=pandas.read_excel("https://github.com/pythonizing/data/blob/master/verlegenhuken.xlsx",sheet_name=0)
df["Temperature"]=df["Temperature"]/10
df["Pressure"]=df["Pressure"]/10
 
p=figure(width=500,height=400,tools='pan')
 
p.title.text="Temperature and Air Pressure"
p.title.text_color="Gray"
p.title.text_font="arial"
p.title.text_font_style="bold"
p.xaxis.minor_tick_line_color=None
p.yaxis.minor_tick_line_color=None
p.xaxis.axis_label="Temperature (°C)"
p.yaxis.axis_label="Pressure (hPa)"    
 
# old versions:
# p.circle(df["Temperature"],df["Pressure"],size=0.5)
 
p.scatter(x=df["Temperature"],y=df["Pressure"],size=0.5)
output_file("Weather.html")
show(p)
  • desde Jupyter Notebook problema leyendo fichero desde URL
  • development/python/pandas.1728563855.txt.gz
  • Darrera modificació: 10/10/2024 05:37
  • per mate