Posts

Showing posts from February, 2019

Creating nested dictionary dynamically in python

Image
0 I am trying to create a nested dictionary dynamically using python. for example I need to create a function that will take the nodes and construct a nested dictionary with these nodes. For example: inputs: 'customers.applicant.individual.first_name' output: customers : applicant: individual: firstname: and for each node, i need to make sure if it exist already if it does than skip else create the node. Can anyone please provide any help on this. Thanks python python-3.x share | improve this question edited Nov 14 '18 at 4:12 khelwood 31.6k 7 43 64 asked Nov 14 '18 at 3:37 skidwa skidwa 6 2 What have you tried so far? – b-fg Nov 14 '18 at 5:52 add a comment  |  0 I am trying to create a nested dictionary dynamically using python. for example I need to create a function that will take the nodes and construct a nested dictionary with these nodes. For example: inputs:

Update rangeslider range on onClick event plotly.js

Image
1 I have implemented a bar chart with rangeslider using react-plotly.js. I set initial range of the slider based on the input given in a date format. I have also implemented onClick event on barchart which would select a particular bar and change the color when I click on it. In addition to that, I would also like to set the rangeslider to select the area where I have clicked the bar. Currently, as you can see in the image above, the rangeslider sets itself back to the initial range value everytime the onClick event is performed. So in order to see the bar that was clicked, I have to manually move the slider to that area. xaxis: type: 'date', autorange: false, fixedrange: true, showgrid: false, range: [moment.unix(this.state.startTime).format('YYYY-MM-DD'), moment.unix(this.state.endTime).format('YYYY-MM-DD')], rangeslider: visible: true <Plot data=this.prepData(this.state.chartData) onClick=(data) => var colors = ; var clickedPo