“python” Réponses codées

python

wise choice for beegginers!
Filthy Flatworm

python

library(dash)
library(dashCoreComponents)
library(dashHtmlComponents)

app <- Dash$new()

df <- read.csv(
  file = "https://raw.githubusercontent.com/plotly/datasets/master/gapminderDataFiveYear.csv",
  stringsAsFactor=FALSE,
  check.names=FALSE
)

continents <- unique(df$continent)
years <- unique(df$year)

# dccSlider starts from 0;
app$layout(
  htmlDiv(
    list(
      dccGraph(id = 'graph-with-slider'),
      dccSlider(
        id = 'year-slider',
        min = 0,
        max = length(years) - 1,
        marks = years,
        value = 0
      )
    )
  )
)

app$callback(
  output = list(id='graph-with-slider', property='figure'),
  params = list(input(id='year-slider', property='value')),

  function(selected_year_index) {

    which_year_is_selected <- which(df$year == years[selected_year_index + 1])

    traces <- lapply(continents,
                     function(cont) {

                       which_continent_is_selected <- which(df$continent == cont)

                       df_sub <- df[intersect(which_year_is_selected, which_continent_is_selected), ]

                       with(
                         df_sub,
                         list(
                           x = gdpPercap,
                           y = lifeExp,
                           opacity=0.5,
                           text = country,
                           mode = 'markers',
                           marker = list(
                             size = 15,
                             line = list(width = 0.5, color = 'white')
                           ),
                           name = cont
                         )
                       )
                     }
    )

    list(
      data = traces,
      layout= list(
        xaxis = list(type = 'log', title = 'GDP Per Capita'),
        yaxis = list(title = 'Life Expectancy', range = c(20,90)),
        margin = list(l = 40, b = 40, t = 10, r = 10),
        legend = list(x = 0, y = 1),
        hovermode = 'closest'
      )
    )
  }
)

app$run_server()
Nervous Narwhal

python

py -m pip install --index-url http://my.package.repo/simple/ SomeProject
Drab Dingo

python

Python 100%
Innocent Impala

python

$ python3 -m pip install flask tinydb
Poised Petrel

python

my best programming language <3
Zealous Zebra

python

Python> 
Steve

python

Wise choice of a programming language there, even learning a decent amount
of Python can go a long way, so yeah, learn from creating your first variable 
and work up until you have mastered the major python modules.
Modern Moth

python

library(dash)
library(dashCoreComponents)
library(dashHtmlComponents)

app <- Dash$new()

app$layout(
  htmlDiv(
    list(
      dccInput(id = 'input-1', type = 'text', value = 'Montreal'),
      dccInput(id = 'input-2', type = 'text', value = 'Canada'),
      htmlDiv(id = 'output_keywords')
    )
  )
)


app$callback(output(id = 'output_keywords', property = 'children'),
             list(input(id = 'input-1', property = 'value'),
                  input(id = 'input-2', property = 'value')),
             function(input1, input2) {
               sprintf("Input 1 is \"%s\" and Input 2 is \"%s\"", input1, input2)
             })

app$run_server()
Nervous Narwhal

python

1
2
3
a = 10 #it is an integer
print(float(a)) #10.0 #it got converted to float datatype
print(str(a)) #"10" #now into a string
chiranjeevi s

Réponses similaires à “python”

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code